홈 / 문서 / cURL

cURL

모든 엔드포인트에 대한 의존성 없는 예제 — 디버깅과 CI 검사에 유용합니다.

모델 목록 조회

curl https://aiprimetech.io/v1/models \
  -H "Authorization: Bearer $CLAUDEAPIKEY"

메시지

curl https://aiprimetech.io/v1/messages \
  -H "x-api-key: $CLAUDEAPIKEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "system": "Be concise.",
    "messages": [{"role": "user", "content": "What is a CDN?"}]
  }'

Chat Completions

curl https://aiprimetech.io/v1/chat/completions \
  -H "Authorization: Bearer $CLAUDEAPIKEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [
      {"role": "system", "content": "Be concise."},
      {"role": "user", "content": "What is a CDN?"}
    ]
  }'

스트리밍

curl -N https://aiprimetech.io/v1/messages \
  -H "x-api-key: $CLAUDEAPIKEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":512,"stream":true,
       "messages":[{"role":"user","content":"Count to five"}]}'

-N curl 자체의 버퍼링을 비활성화합니다. 이 설정이 없으면 전체 스트림이 한꺼번에 표시되어 스트리밍이 작동하지 않는 것처럼 보입니다.

CI 상태 확인

"c">#!/usr/bin/env bash
set -euo pipefail
code=$(curl -s -o /dev/null -w "%{http_code}" https://aiprimetech.io/v1/models \
  -H "Authorization: Bearer $CLAUDEAPIKEY")
[ "$code" = "200" ] || { echo "gateway check failed: $code" >&2; exit 1; }
echo "gateway ok"