시작하기

빠른 시작

세 단계면 첫 호출에 성공합니다. 모든 예시는 현재 온라인인 모델을 사용합니다.

#AI 에이전트에게 연동 맡기기

Claude Code, Cursor, Codex를 쓰시나요? 이 프롬프트를 붙여 넣으면 전체 API 명세를 읽고 클라이언트, 재시도, 작업 폴링 코드를 작성해 줍니다.

프롬프트 보기
Please integrate the APIKing API into this project.

Read these two documents first and implement what they say; do not assume OpenAI defaults:
- Full API contract: https://apiking.ai/llms-full.txt
- OpenAPI spec: https://apiking.ai/openapi.json

Basics
- Base URL: https://apiking.ai/v1, OpenAI-compatible. Use the official OpenAI SDK and change only base_url and the key.
- Anthropic SDK / Claude Code: base URL https://apiking.ai; the endpoint is /v1/messages.
- Auth: Authorization: Bearer <key>. Read the key from the APIKING_API_KEY environment variable. Never hard-code or commit it, and never ship it in a browser or app bundle.
- Do not guess model IDs: call GET /v1/models and pick from what it returns. Ask me when unsure.

Pick the endpoint by task
- Chat: POST /v1/chat/completions (or /v1/responses); Anthropic format: POST /v1/messages.
- Images, video, music and 3D are async tasks: submit, get a task_id, then poll its status.
  - Image, music, 3D: queued → processing → succeeded / failed.
  - Video: queued → in_progress → completed / failed.
  - unknown is not terminal: poll until a deadline, then reconcile. Never treat it as success.
  - You can pass webhook_url at submit instead, but the status endpoint stays the source of truth.
- Balance: GET /v1/balance, free and not billed.

Errors and retries
- Errors look like {"error":{"message","type","code"}}; branch on code.
- Every response carries X-Oneapi-Request-Id. Log it; support asks for it.
- 429: wait Retry-After, then retry. 5xx: retry with exponential backoff. Other 4xx: do not retry.
- Send an Idempotency-Key on paid non-streaming writes (task submits above all) and reuse it on retries, so a retry is never charged twice. Streaming requests must not carry it.

Deliver
1. A client module that wraps the retries, idempotency keys and task polling above.
2. One minimal example that runs as is.
3. A README note on setting APIKING_API_KEY.
Ask me before running anything that makes a paid request.

또는 Agent Skill로 설치하면 매 세션마다 APIKing을 알고 시작합니다:

Claude Code 전용(Node 불필요):

#1. API 키 만들기

키는 한 번만 표시됩니다. 웹 페이지가 아닌 서버에 보관하세요.

API 키 만들기

모든 요청은 이 주소로 보냅니다:

#2. 요청 하나 복사하기

YOUR_API_KEY를 내 키로 바꾼 뒤 실행하세요.

API_KEY="${API_KEY:-YOUR_API_KEY}"

curl --fail-with-body -sS https://apiking.ai/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "GPT-5.6 Luna",
  "messages": [
    {
      "role": "user",
      "content": "Say hello."
    }
  ],
  "stream": false
}'

이미 OpenAI SDK를 쓰고 있나요?

base_url과 api_key만 바꾸세요. 기존 클라이언트, 메시지 형식, 스트리밍 파서, 재시도 래퍼는 그대로 유지됩니다.

#3. 응답 확인하기

이런 200 응답이 오면 연결된 것입니다.

response.json
{
  "id": "chatcmpl_xxx",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello!"
      }
    }
  ]
}

아직 해결되지 않았나요?

요청 ID나 오류 메시지를 보내 주시면 확인해 드리겠습니다.