이번 블랙프라이데이에는, 더 많이 만들고 더 많이 판매하세요.자세히 보기
본문으로 이동
추상적인 휴대폰 결제 화면에서 주황색 컨트롤이 파란 버튼을 일부 가리는 모습
튜토리얼

GLM-5.4 사용법: 첫 API 호출부터 스크린샷으로 UI 수정하기

EvoLink에서 GLM-5.4를 호출하고 스크린샷과 HTML, CSS를 보내 모바일 결제 버튼 수정 결과를 확인합니다.

Himi LiProduct Manager at EvoLink
10분 소요
EvoLink의 Chat Completions API에서 glm-5.4를 사용할 수 있습니다. EvoLink API 키로 짧은 텍스트 요청을 보낸 뒤 스크린샷과 해당 화면의 코드를 함께 보냅니다. 예시에서는 390 CSS 픽셀 너비에서 도움말 버튼이 Place order 오른쪽을 가립니다. CSS 패치를 요청한 다음 두 버튼이 모두 클릭되는지 확인합니다. EvoLink API 키 발급

텍스트만 보내서 API 호출 확인하기

EvoLink API 키와 curl, jq가 필요합니다. 3단계에는 Python 3도 사용합니다. 명령을 실행할 셸에서 EVOLINK_API_KEY를 설정하세요. 두 예시 모두 https://api.evolink.ai/v1/chat/completions로 요청을 보내며 Bearer 헤더에 키를 넣습니다. API 키 관리
curl --silent --show-error --fail-with-body \
  https://api.evolink.ai/v1/chat/completions \
  -H "Authorization: Bearer ${EVOLINK_API_KEY:?Set EVOLINK_API_KEY}" \
  -H 'Content-Type: application/json' \
  --data '{
    "model": "glm-5.4",
    "stream": false,
    "reasoning_effort": "low",
    "messages": [
      { "role": "user", "content": "Reply with just the word READY." }
    ]
  }' \
  -o text-response.json &&
jq -e '{model, answer: .choices[0].message.content, usage}
  | select((.answer // "") | length > 0)' text-response.json
API 응답 상태가 성공이고 choices[0].message.content에 답변이 있다면 첫 요청을 통과했습니다. 기대하는 답변은 READY입니다. model은 엔드포인트가 보고한 모델입니다. 스크린샷 요청과 비교하도록 usage를 보관하세요. EvoLink 응답 예시

모바일 화면에서 버튼 겹침 재현하기

다음 코드를 checkout.html로 저장합니다. 브라우저에서 파일을 열고 반응형 뷰포트를 390 × 540 CSS 픽셀로 설정합니다. 도움말 버튼이 주문 버튼 오른쪽을 가립니다. 1280 × 720에서는 두 버튼이 서로 다른 영역에 있습니다.
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Checkout overlap example</title>
<style>
  body { margin: 0; background: #f4f6fa; color: #182235; font: 16px system-ui, sans-serif; }
  main { max-width: 26rem; margin: 48px auto; padding: 0 16px; }
  h1 { margin: 0 0 24px; }
  .summary { padding: 20px; border: 1px solid #dae0eb; border-radius: 12px; background: white; }
  .summary p:first-child { margin-top: 0; }
  .summary p:last-child { margin-bottom: 0; }
  .actions { position: fixed; inset: auto 16px 24px; display: grid; max-width: 26rem; margin-inline: auto; }
  button { font: inherit; font-weight: 600; cursor: pointer; }
  .place-order { width: 100%; min-height: 52px; border: 0; border-radius: 10px; background: #1742bf; color: white; }
  .help-bubble { position: fixed; right: 16px; bottom: 16px; z-index: 2; width: 112px; min-height: 44px; border: 0; border-radius: 24px; background: #17243d; color: white; }
</style>
<main>
  <h1>Checkout</h1>
  <section class="summary" aria-label="Order summary">
    <p>Travel mug × 1</p>
    <p><strong>Total $24.00</strong></p>
  </section>
  <p id="status" role="status"></p>
</main>
<div class="actions">
  <button class="place-order" type="button">Place order</button>
  <button class="help-bubble" type="button">Need help?</button>
</div>
<script>
  const statusLine = document.querySelector("#status");
  document.querySelector(".place-order").onclick = () => { statusLine.textContent = "Order button clicked"; };
  document.querySelector(".help-bubble").onclick = () => { statusLine.textContent = "Help button clicked"; };
</script>
</html>
390px 원본 스크린샷을 checkout-390.png로 저장해 checkout.html과 같은 폴더에 넣거나 같은 크기로 다시 캡처합니다. 정적 예시에서 두 버튼은 어느 쪽이 클릭되었는지만 표시합니다.
뷰포트 너비 390 CSS 픽셀에서 Need help가 Place order의 오른쪽 아래를 가린 모습.
뷰포트 너비 390 CSS 픽셀에서 Need help가 Place order의 오른쪽 아래를 가린 모습.

스크린샷과 소스 코드를 함께 보내기

스크린샷은 가려진 버튼을 보여 줍니다. 소스에서는 패치를 제안하는 데 필요한 셀렉터, 위치 및 쌓임 순서를 확인할 수 있습니다. 다음 지시문을 같은 폴더에 repair-prompt.txt로 저장하세요.
The attached screenshot is checkout.html at a viewport of 390 × 540 CSS pixels.
The Need help button covers the right edge of Place order.

Use the screenshot and the source below to explain which CSS rules cause the overlap.
Return one minimal CSS-only unified diff for checkout.html. Keep both buttons
visible and clickable at 390 px, with no horizontal overflow. Preserve the fixed
bottom-right help position and the centered action at 1280 px. Keep both labels
and click handlers. Finish with instructions for checking the right edge of
Place order, the help button, and the desktop layout.
PNG는 Base64 데이터 URL로 만들어 image_url 블록에 넣습니다. EvoLink가 직접 가져올 수 있는 공개 이미지 URL도 쓸 수 있습니다. GLM-5.4의 추론은 항상 켜져 있고, reasoning_effort에는 low, high, max를 지정할 수 있습니다. 예시는 high를 사용하며 추론과 최종 응답에 출력 토큰 8,192개를 함께 할당합니다.
python3 - <<'PY' > screenshot-request.json
import base64
import json
from pathlib import Path

image = base64.b64encode(Path("checkout-390.png").read_bytes()).decode("ascii")
prompt = Path("repair-prompt.txt").read_text(encoding="utf-8")
source = Path("checkout.html").read_text(encoding="utf-8")

print(json.dumps({
    "model": "glm-5.4",
    "stream": False,
    "reasoning_effort": "high",
    "max_tokens": 8192,
    "messages": [{
        "role": "user",
        "content": [
            {"type": "text", "text": f"{prompt}\n\ncheckout.html:\n{source}"},
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image}"}},
        ],
    }],
}))
PY

curl --silent --show-error --fail-with-body \
  https://api.evolink.ai/v1/chat/completions \
  -H "Authorization: Bearer ${EVOLINK_API_KEY:?Set EVOLINK_API_KEY}" \
  -H 'Content-Type: application/json' \
  --data-binary @screenshot-request.json \
  -o screenshot-response.json &&
jq -e '{model, finish_reason: .choices[0].finish_reason,
  answer: .choices[0].message.content, usage}
  | select((.answer // "") | length > 0)' screenshot-response.json
answer에서 패치를 읽으세요. EvoLink는 미디어를 입력 토큰으로 청구하므로 usage.prompt_tokens에는 처리된 스크린샷, 지시문, 소스가 함께 포함됩니다. completion_tokens는 추론을 포함한 출력 사용량입니다. 제공되는 경우 prompt_tokens_details.cached_tokens로 캐시 적중 토큰을 확인합니다. 텍스트 요청과의 차이에는 추가 설명과 소스도 포함됩니다. EvoLink API 사용량과 청구 내역

패치를 적용하고 검증하기

diff를 읽고 로컬 사본에 적용합니다. 예시의 좁은 화면에서는 두 버튼이 오른쪽 아래에 겹칩니다. 도움말 버튼의 z-index가 높아 겹친 영역의 클릭을 가로챕니다. 다음 참조 CSS는 좁은 화면에서 두 버튼을 다른 줄에 둡니다. 기존 스타일 뒤에 넣어 모델의 패치와 비교할 수 있습니다.
@media (max-width: 720px) {
  .actions { gap: 8px; }
  .help-bubble { position: static; justify-self: end; }
}
확인기대 결과
390 × 540에서 주문 버튼 오른쪽 경계로부터 안쪽 12px, 세로 중앙 클릭Order button clicked가 표시됩니다. 수정 전에는 주문 버튼 안의 같은 상대 좌표에서 도움말이 클릭됩니다.
390 × 540에서 도움말 클릭Help button clicked가 표시됩니다. 두 버튼이 보이고 겹침이나 가로 스크롤이 없습니다.
1280 × 720에서 두 버튼을 각각 클릭각각의 상태가 표시됩니다. 주문 버튼은 가로 중앙, 도움말은 오른쪽과 아래에서 각각 16px 떨어진 고정 위치를 유지합니다.

참조 CSS는 작성자가 만든 예시입니다. 클릭 검증은 Chromium에서 진행했습니다.

이 390px 브라우저 예시에서는 겹친 영역을 처음 클릭할 때 도움말이 열립니다. CSS 예제 패치를 적용하면 Place order와 **Need help?**가 각각 다른 상태를 표시합니다. 영상에서 튜토리얼의 패치를 브라우저로 확인하는 방법을 볼 수 있습니다.

자주 발생하는 오류

  • 텍스트 요청이 실패합니다. text-response.json의 오류를 확인하세요. EVOLINK_API_KEY의 키가 유효하고 본문에서 glm-5.4를 지정했는지 점검합니다.
  • 텍스트는 되는데 이미지가 실패합니다. PNG인지, 데이터 URL이 data:image/png;base64,로 시작하는지 확인합니다. 호스팅 이미지는 로그인이나 쿠키 없이 원본에 접근할 수 있어야 합니다.
  • diff 없이 응답이 끝납니다. finish_reason을 봅니다. 길이 제한에 도달했다면 관련 없는 소스를 줄이거나 출력 예산을 조정합니다. choices[0].message.content에서 패치를 읽고 브라우저의 검증 절차를 적용합니다.
자신의 스크린샷과 해당 컴포넌트로도 같은 과정을 실행할 수 있습니다. GLM-5.4 사용처와 과금 방식 비교
다른 작업에는 GLM-5.4가 받는 입력 형식을 확인하세요. 코딩 CLI를 이미 쓰고 있다면 EvoLink 게이트웨이 설정 가이드를 참고하고, 비교할 작업을 정할 때는 GLM-5.4 벤치마크를 활용할 수 있습니다.

통합 API로 AI 모델 연동하기

모델 기능과 현재 요금을 비교한 뒤 API 문서에 따라 작업에 맞는 모델을 연동하세요.