API 문서

세계 최고 수준의 AI model에 대한 통합 액세스. OpenAI-compatible API — 모든 model을 위한 하나의 key.

API 기본 URL

https://tokenhub.store/api/v1

모든 API 요청은 이 base URL을 사용합니다. OpenAI SDKs와 완벽하게 호환됩니다.

빠른 시작

몇 분 만에 시작하기

  1. 계정 만들기 후 Dashboard에 로그인하세요
  2. 이동하여 API Keys 에서 새 API key를 생성하세요
  3. 방문하여 결제 에서 계정에 Credits를 추가하세요
  4. 지원되는 모든 model로 API 호출을 시작하세요

지원되는 Models

provider를 클릭하면 사용 가능한 model과 코드 예제를 볼 수 있습니다.

OpenAI

10개 model

GPT 시리즈를 만든 선도적인 AI 연구 회사입니다. 뛰어난 추론과 코딩 역량을 갖춘 최첨단 language model로 잘 알려져 있습니다.

Anthropic

8개 model

Claude model로 잘 알려진 AI safety 회사입니다. 강력한 안전 기능과 함께 미묘한 대화, code, 복잡한 추론에 뛰어납니다.

Google

9개 model

Google의 Gemini 제품군은 업계 최고 수준의 최대 2M tokens context window를 제공하는 최첨단 멀티모달 기능을 제공합니다.

xAI

3개 model

Elon Musk의 AI 회사입니다. Grok model은 실시간 지식, 재치 있는 응답, 뛰어난 코딩 지원으로 잘 알려져 있습니다.

Alibaba (Qwen)

3개 model

Alibaba의 Qwen 시리즈는 강력한 다국어 모델로, 영어와 중국어 작업 모두에서 뛰어난 성능을 제공합니다.

Zhipu AI (GLM)

3개 model

Zhipu AI의 GLM 시리즈입니다. 최대 200K context window를 지원하는 고급 중국어-영어 이중언어 model입니다.

MiniMax

2개 model

MiniMax의 M2 시리즈입니다. 강력한 다국어 기능과 함께 205K의 초장문 context를 지원합니다.

Xiaomi (MiMo)

2개 model

Xiaomi의 MiMo V2 model입니다. 최대 1M Tokens의 대형 context window를 제공합니다.

Alibaba (Qwen3)

3개 model

Alibaba의 Qwen3 시리즈입니다. 비전-언어 및 코딩 특화 기능을 갖춘 대규모 MoE model입니다.

Moonshot AI (Kimi)

2개 model

Moonshot AI의 Kimi K2 시리즈입니다. 확장된 context window와 강력한 추론 기능을 제공합니다.

DeepSeek

6개 model

DeepSeek의 최신 model입니다. 강력한 추론 및 코딩 기능을 갖춘 매우 비용 효율적인 선택입니다.

ByteDance (Seedance)

2개 model

ByteDance의 Seedance 비디오 생성 model입니다. 오디오 지원과 함께 시네마급 품질의 text-to-video, image-to-video, 멀티모달 비디오 편집을 제공합니다.

ByteDance (Seedream)

2개 model

ByteDance의 Seedream 이미지 생성 model입니다. 사실적이고 예술적인 스타일의 고품질 text-to-image를 제공합니다.

Kwaivgi (Kling)

2개 model

Kwaivgi의 Kling 비디오 생성 model입니다. std/pro mode를 지원하는 고품질 text-to-video 및 image-to-video를 제공합니다. 길이 3–15s. std: $0.168/s, pro: $0.224/s (오디오 없음).

Gemini API

Gemini 3.5–3.8 Flash and Gemini 4 Argon use /chat/completions. For Argon, use model ID google/gemini-4-argon. GET /models lists published models. For an unlisted model configured by your account administrator, use the exact model ID they provide with the same endpoint.

curl "https://tokenhub.store/api/v1/chat/completions" \
  -H "Authorization: Bearer th-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.8-flash",
    "messages": [{"role": "user", "content": "Hello"}],
    "reasoning_effort": "low",
    "max_tokens": 1024,
    "stream": true
  }'

Supports streaming, system instructions, function calling, and base64 image data URLs. reasoning_effort accepts low, medium, or high; max_tokens includes thinking tokens.

For multi-turn tools, keep the complete assistant message, including tool_calls.extra_content or content_blocks, so thought signatures are preserved. Native Gemini endpoints are not exposed by TokenHub.

Gemini Flash and Argon output usage includes thinking tokens. Cached input is counted at the configured cache-read rate when available. See the model catalog for current prices; confirm rates for unlisted models with your account administrator.

Responses API 스트리밍 및 요금

POST /v1/responses의 response.completed는 응답 완료를 나타냅니다. 이 이벤트 수신 후 연결을 닫아도 성공한 요청이 취소로 변경되지 않습니다.

0을 포함하여 공급자가 보고한 토큰 수를 우선 사용합니다. 누락된 값만 추정합니다. 완료 전에 취소해도 처리된 토큰에 요금이 부과될 수 있습니다.

API 엔드포인트

POST /chat/completions

스트리밍 지원이 포함된 chat completion 생성

헤더

headers
Authorization: Bearer th-your-api-key
Content-Type: application/json

요청 본문

json
{
  "model": "openai/gpt-4.1",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "temperature": 0.7,
  "max_tokens": 1000,
  "stream": false
}

POST /responses

OpenAI Responses 네이티브 요청을 JSON 및 SSE 그대로 전달

헤더

headers
Authorization: Bearer th-your-api-key
Content-Type: application/json

요청 본문

json
{
  "model": "openai/gpt-5.6-terra",
  "input": "Explain why the sky is blue in one sentence.",
  "reasoning": { "effort": "medium" },
  "max_output_tokens": 256,
  "stream": false
}

POST /videos/generations

텍스트 또는 이미지 프롬프트로 비디오 생성 (Seedance & Wan 2.2 models)

헤더

headers
Authorization: Bearer th-your-api-key
Content-Type: application/json

요청 본문

json
{
  "model": "bytedance/doubao-seedance-2.0",
  "prompt": "A golden retriever running on a sunny beach",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}

요청 본문 (content 배열 — first_frame & last_frame)

json
{
  "model": "bytedance/doubao-seedance-2.0",
  "prompt": "Hand picks a fresh apple from the tree, the scene smoothly transitions to a hand holding an apple smoothie drink, cinematic lighting in an orchard",
  "content": [
    {
      "type": "image_url",
      "image_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic1.jpg" },
      "role": "first_frame"
    },
    {
      "type": "image_url",
      "image_url": { "url": "https://ark-project.tos-cn-beijing.volces.com/doc_image/r2v_tea_pic2.jpg" },
      "role": "last_frame"
    }
  ],
  "duration": 5,
  "resolution": "720p"
}

매개변수

content (선택): 미디어 에셋 배열. 각 항목에는 다음이 포함됩니다:

  • type: "image_url"
  • image_url.url: 이미지의 URL
  • role: <firstFrame/> (최대 1개), <lastFrame/> (최대 1개), <refImage/>, <refVideo/>, <refAudio/>

GET /videos/generations/{id}

video generation 작업의 상태를 확인합니다

헤더

headers
Authorization: Bearer th-your-api-key

응답

json
{
  "id": "tsk-xxx",
  "object": "video.generation.task",
  "model": "bytedance/doubao-seedance-2.0",
  "status": "succeeded",  // "queued" | "running" | "succeeded" | "failed"
  "data": [
    {
      "video_url": "https://..."
    }
  ]
}

POST /images/generations

텍스트 프롬프트로 이미지를 생성합니다 (Seedream models)

헤더

headers
Authorization: Bearer th-your-api-key
Content-Type: application/json

요청 본문

json
{
  "model": "bytedance/doubao-seedream-5.0",
  "prompt": "A serene mountain landscape at sunset",
  "n": 1,
  "size": "2048x2048"
}

GET /models

사용 가능한 모든 model을 나열합니다

현재 공개된 모델과 요금은 모델 목록과 요금 페이지에서 확인하세요. 페이지는 자동으로 업데이트됩니다.

Account management API

Generate an access token in Settings → Account information. Send Authorization: Bearer YOUR_ACCESS_TOKEN and TokenHub-User: YOUR_USER_ID. New-Api-User is also accepted; if both user headers are supplied, they must match. Open settings

Access tokens manage your account. Continue using th- API keys for model requests.

HTTPEndpointDescription
GET/api/balanceAccount credit balance (1 credit = 1 USD)
GET / POST/api/keysList keys or create a key
GET / PATCH / DELETE/api/keys/{id}Get a key, edit its name/status/budget, or delete it
GET/api/keys/{id}/discountsRead the effective discounts for your key
GET / PATCH/api/user/profileRead account details or update your name
GET/api/usageRequest details and usage totals, filterable by key, model, and time
GET/api/v1/billing/usageRequest details and usage totals, filterable by key, model, and time
GET/api/v1/billing/spendingAccount spending trends
GET/api/v1/billing/invoicesList invoices
GET / POST/api/v1/billing/budgetRead or configure account budgets
export TOKENHUB_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"
export TOKENHUB_USER_ID="YOUR_USER_ID"

curl "https://tokenhub.store/api/balance" \
  -H "Authorization: Bearer $TOKENHUB_ACCESS_TOKEN" \
  -H "TokenHub-User: $TOKENHUB_USER_ID"

curl "https://tokenhub.store/api/keys" \
  -H "Authorization: Bearer $TOKENHUB_ACCESS_TOKEN" \
  -H "TokenHub-User: $TOKENHUB_USER_ID" \
  -H "Content-Type: application/json" \
  -d '{"name":"My application","spendLimit":10}'

curl --get "https://tokenhub.store/api/v1/billing/usage" \
  -H "Authorization: Bearer $TOKENHUB_ACCESS_TOKEN" \
  -H "TokenHub-User: $TOKENHUB_USER_ID" \
  --data-urlencode "apiKeyId=YOUR_API_KEY_ID" \
  --data-urlencode "model=alibaba/qwen-turbo" \
  --data-urlencode "startDate=2026-09-07T00:00:00Z" \
  --data-urlencode "endDate=2026-09-08T00:00:00Z" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20"

Usage filters: apiKeyId is the ID returned by /api/keys, not the th- secret. model matches the full model ID exactly. Send startDate and endDate together as ISO timestamps with a timezone (inclusive boundaries). page defaults to 1; limit defaults to 20, maximum 100. Summary covers all matching records. Omit apiKeyId to query the account. An unknown key or a key owned by another account returns 404. API keys retain their existing account-wide billing access. /api/usage also accepts start_date/end_date, one-sided ranges, limit (default 100, maximum 1000), and offset (default 0).

Create: name=My application, spendLimit=10; omit spendLimit for the shared wallet. PATCH accepts name, isActive, and action (set_limit, add_budget, clear_limit, reset_spent); set_limit/add_budget also need a non-negative value. set_limit resets spent; add_budget preserves spent for an existing cap. GET /api/keys/:id returns the full model key. Deleting a key removes its UsageLog association; use isActive:false to retain usage filtering by key.

API 키를 이름이나 접두사로 검색하고 페이지당 20개씩 볼 수 있습니다. 새 키는 첫 페이지에 표시됩니다. 다른 창이나 API에서 만든 키를 보려면 목록을 새로고침하세요. API Keys

One active access token per account. It remains valid until regenerated or revoked; the database stores only its hash. Token lifecycle endpoints GET/POST/DELETE /api/user/access-token require a browser login. Tokens cannot manage their own lifecycle or authorize admin, password, account-deletion, or model-generation endpoints. Invalid tokens or mismatched user IDs return 401. Existing browser-session authentication continues to work.

코드 예제

cURL

bash
curl https://tokenhub.store/api/v1/chat/completions \
  -H "Authorization: Bearer th-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4.1",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Python (OpenAI SDK)

python
from openai import OpenAI

client = OpenAI(
    api_key="th-your-api-key",
    base_url="https://tokenhub.store/api/v1"
)

# Use any supported model
response = client.chat.completions.create(
    model="openai/gpt-5.4",  # Or any other model
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)

JavaScript / TypeScript

typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'th-your-api-key',
  baseURL: 'https://tokenhub.store/api/v1',
});

// Use any supported model
const response = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-4-6',
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(response.choices[0].message.content);

스트리밍 예제 (Python)

python
from openai import OpenAI

client = OpenAI(
    api_key="th-your-api-key",
    base_url="https://tokenhub.store/api/v1"
)

stream = client.chat.completions.create(
    model="google/gemini-2.5-pro",
    messages=[{"role": "user", "content": "Write a short story."}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

도움이 필요하신가요?