Documentation

Classai Router API

Compatible with OpenAI Chat Completions and Anthropic Messages. If your code already works with either SDK, just swap the base URL and API key.

For AI agents:llms.txtopenapi.jsonMCP: router.classai.id/mcpEvery section has a “Copy for AI” button.

Quick start

Base URL:

https://router.classai.id/v1

Copy the default key from Dashboard → API Keys (created automatically when you sign up), buy credits or a package, then run it — this base URL and API key are all you need, no other app required:

curl https://router.classai.id/v1/chat/completions \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-5.5",
    "messages": [
      {"role": "user", "content": "Hi! Explain AI in one sentence."}
    ]
  }'

Authentication

Send the key in the Authorization: Bearer sk_live_… header. The x-api-key header is also accepted (used by the Anthropic SDK). Every account automatically gets one default key; create extra keys or fork an existing one for other apps/team members — they all share the same balance & packages, with separate usage records. Keep keys on the server or in environment variables — never in frontend code.

Endpoints

Method & pathFormat
POST /v1/chat/completionsOpenAI Chat Completions (messages, tools, stream)
POST /v1/messagesAnthropic Messages (Claude Code, Anthropic SDK)
POST /v1/completionsOpenAI legacy completions
GET /v1/modelsActive models + price per 1M tokens

Streaming

Send "stream": true to receive the answer incrementally via Server-Sent Events. The last chunk contains usage (token counts) — we add stream_options.include_usage automatically so usage is recorded accurately.

Models & pricing

Prices per 1 million tokens. 1 billion kredit = $12.48. The full catalog is on the models page.

Model IDContextInput / 1MOutput / 1M
claude-opus-5.5Claude Opus 5.51M52,8 jt kredit264 jt kredit
claude-sonnet-5.5Claude Sonnet 5.51M26,4 jt kredit132 jt kredit
claude-opus-5Claude Opus 5200K66 jt kredit330 jt kredit
claude-sonnet-5Claude Sonnet 5200K26,4 jt kredit132 jt kredit
claude-sonnet-4.6Claude Sonnet 4.6200K39,6 jt kredit198 jt kredit
claude-haiku-4.5Claude Haiku 4.5200K6,6 jt kredit33 jt kredit
claude-haiku-5.5Claude Haiku 5.51M10,8 jt kredit33 jt kredit
glm-5.3GLM 5.31M12,5 jt kredit61,6 jt kredit
deepseek-v4.1-flashDeepSeek V4.1 Flash1M8,3 jt kredit30,3 jt kredit
deepseek-v4.1-flash-1017DeepSeek V4.1 Flash 10171M7,7 jt kredit28 jt kredit
kimi-k3Kimi K3256K19,8 jt kredit99 jt kredit
glm-5.2GLM 5.21M12,3 jt kredit61,6 jt kredit
minimax-m3MiniMax M31M6 jt kredit23,1 jt kredit
kimi-k2.7-codeKimi K2.7 Code250K8,4 jt kredit41,8 jt kredit
minimax-m2.7MiniMax M2.7200K5,3 jt kredit13,2 jt kredit
deepseek-v4-flashDeepSeek V4 Flash1M7,7 jt kredit30,9 jt kredit
deepseek-v4-flash-0731DeepSeek V4 Flash 07311M7,2 jt kredit27,5 jt kredit
deepseek-v4-proDeepSeek V4 Pro1M20,9 jt kredit55 jt kredit
deepseek-v4-pro-0813DeepSeek V4 Pro 08131M21,4 jt kredit55 jt kredit
glm-5.3-flashGLM 5.3 Flash1M7,4 jt kredit30,8 jt kredit
glm-5.1GLM 5.1200K12,3 jt kredit61,6 jt kredit
kimi-k2.6Kimi K2.6256K8,4 jt kredit41,8 jt kredit
gemini-3.8-flashGemini 3.8 Flash1M14 jt kredit56 jt kredit
claude-opus-4.6Claude Opus 4.6200K66 jt kredit330 jt kredit
gpt-6-astraGPT-6 Astra400K66 jt kredit330 jt kredit
gpt-5.6-solGPT-5.6 Sol400K34,2 jt kredit110 jt kredit
gpt-6-solGPT-6 Sol1M34,2 jt kredit110 jt kredit
gpt-6.1-solGPT 6.1 Sol1.1M34,2 jt kredit100 jt kredit
gpt-5.6-terraGPT-5.6 Terra1M28,8 jt kredit82,5 jt kredit
gemini-3.8-seriesGemini 3.8 Series1M9 jt kredit43,6 jt kredit
gpt-5.6-lunaGPT-5.6 Luna1M12,4 jt kredit61,9 jt kredit
qwen3.8-maxQwen 3.8 Max1M13,2 jt kredit66 jt kredit
claude-opus-4.8Claude Opus 4.81M66 jt kredit330 jt kredit
coding-china-autoCoding Plan China (auto)1M12,5 jt kredit61,6 jt kredit
coding-us-autoCoding Plan US (auto)200K30 jt kredit150 jt kredit
gpt-6-lunaGPT-6 Luna1M12,4 jt kredit61,9 jt kredit
grok-4.7Grok 4.7500K21,1 jt kredit66 jt kredit
hy3Hy3256K9,9 jt kredit49,5 jt kredit
qwen3.7-maxQwen 3.7 Max1M9,8 jt kredit48,7 jt kredit
qwen3.7-plusQwen 3.7 Plus1M5,4 jt kredit24,7 jt kredit
claude-opus-4.7Claude Opus 4.7200K66 jt kredit330 jt kredit
kai-baikKai Grant · DeepSeek V4.1 Flash1M0 kredit0 kredit
longcat-2.5:freeLongCat 2.5 (Free)—0 kredit0 kredit
step-3.7-flash:freeStep 3.7 Flash (Free)—0 kredit0 kredit
solar-mini4:freeSolar Mini 4 (Free)—0 kredit0 kredit
nemotron-3-ultra:freeNemotron 3 Ultra 550B (Free)1M0 kredit0 kredit
nemotron-3.5-super-vl:freeNemotron 3.5 Super VL (Free)1M0 kredit0 kredit
nemotron-3.5-lightning:freeNemotron 3.5 Lightning (Free)1M0 kredit0 kredit
nemotron-3-nano-omni:freeNemotron 3 Nano Omni (Free)256K0 kredit0 kredit
north-mini-code:freeNorth Mini Code (Free)256K0 kredit0 kredit
gemma-4-31b:freeGemma 4 31B (Free)262K0 kredit0 kredit
gemma-4-26b:freeGemma 4 26B (Free)262K0 kredit0 kredit
dots-3-note:freedots 3 Note (Free)512K0 kredit0 kredit
flint-1.0:freeFlint 1.0 (Free)262K0 kredit0 kredit
lfm-3-1.7b:freeLFM 3 1.7B (Free)262K0 kredit0 kredit

How cost is calculated

Cost = input tokens × input price + output tokens × output price. Token counts come from the usage reported by the model; if a model doesn't send usage while streaming, we estimate it from the text length (≈ 4 characters per token).

Example: 1,000 input tokens + 500 output tokens on claude-opus-5.5 = $0.0023 ≈ 185 rb kredit.

Failed requests (errors from the model or the gateway) aren't charged. Some models add an internal system prompt, so input tokens can be slightly higher than the text you send.

Input tokens the model reads from cache are billed at half price — see Prompt caching.

Prompt caching (automatic savings)

Coding agents like Claude Code, opencode, Cline, and Cursor resend the entire conversation at every step: system instructions, the tool list, chat history, and the contents of files already read. The leading part that matches the previous request can be read by the model from cache instead of being processed again.

  • Automatic, no setup. No need to instruct the AI in opencode, change your prompt, or add parameters. For Claude models, the Router adds the cache_control marker itself if your tool hasn't set it (Claude Code already does); other models cache automatically on the model side.
  • Half price. Input tokens read from cache are billed at 50% of the input price. Output tokens and the uncached part are billed normally. Applies to credits and token packages bought from 10 October 2026; packages bought before that date count all tokens at full price.
  • Not always 100%. How much gets cached depends on the model and the route serving it — in agent sessions usually 40–95% of input tokens. Short prompts (under ±1,000–4,000 tokens) aren't cached.

To hit the cache more often: don't change system instructions, AGENTS.md, or the tools/MCP list mid-session, and keep the session going without long pauses (the cache usually lasts a few minutes). When switching tasks, start a new session or run /compact so the conversation doesn't keep growing.

Personal data redaction (automatic)

Before a prompt is sent to the model provider, the gateway replaces certain personal data with placeholders. Only the text you send is redacted (messages, system instructions, tool results) — not tool definitions, tool call arguments, images, or files.

ModeWhat's redactedHeader
Standard (default)16-digit NIK (Indonesian ID number) → [NIK disensor], payment card numbers → [nomor kartu disensor]— (no header)
StrictAll of the above + email addresses and Indonesian phone numbersx-classai-pii: strict
OffNothing (e.g. an agent editing test data that contains sample card numbers)x-classai-pii: off

NIKs are recognized by their pattern (province code, birth date, month), and card numbers by the card network prefix plus a Luhn check — so ordinary numbers like order IDs or timestamps aren't redacted. Redaction is deterministic (same input → same output), so prompt caching still works.

curl https://router.classai.id/v1/chat/completions \
  -H "Authorization: Bearer sk_live_…" \
  -H "x-classai-pii: strict" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-5.5","messages":[{"role":"user","content":"Hello"}]}'

Redaction is a safety layer, not a guarantee: still don't send unnecessary sensitive data to any AI model.

Voice (text-to-speech & voice cloning)

Turn text into audio with the same key and credits. The endpoint is compatible with OpenAI /v1/audio/speech, so the OpenAI SDK works as is. A no-code version is in Voice Studio.

curl https://router.classai.id/v1/audio/speech \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"model":"gemini-tts","voice":"Kore","input":"Hi, welcome to Classai!","response_format":"mp3"}' \
  --output speech.mp3
FieldDescription
modelRequired. Engine id from the table below.
inputRequired. The text to read, up to the engine's Max characters.
voiceRequired. A voice id from GET /v1/audio/voices?model=<model>, or clone:<id> for your cloned voice.
response_formatmp3 (default) or wav.
speed0.7–1.2 (default 1, or the calibrated voice's best pace).
stylenatural · narasi · iklan · santai · berita · edukasi (natural, narration, ad, casual, news, educational).
normalizefalse = send the text as is (no automatic Indonesian spelling or dictionary).
voice_settingsOptional: stability, similarity_boost, style (0–1), use_speaker_boost (true/false).
# Every active engine + price
curl https://router.classai.id/v1/audio/voices -H "Authorization: Bearer sk_live_…"

# One engine's voices (id, name, free sample audio)
curl "https://router.classai.id/v1/audio/voices?model=gemini-tts" -H "Authorization: Bearer sk_live_…"
modelEngineCredits per minute*Max charactersClone
voxcpm2VoxCPM2 · OpenBMB5,3 jt kredit5.00033,3 jt kredit one-time
dots-ttsdots.tts · rednote5,3 jt kredit5.00033,3 jt kredit one-time
elevenlabs-v4Eleven v4 · ElevenLabs28 jt kredit5.000100 jt kredit one-time
elevenlabs-v4-turboEleven v4 Turbo · ElevenLabs14 jt kredit5.000100 jt kredit one-time
elevenlabs-flashEleven Flash v2.5 · ElevenLabs14 jt kredit5.000100 jt kredit one-time
elevenlabs-v2Eleven Multilingual v2 · ElevenLabs28 jt kredit5.000100 jt kredit one-time
openai-ttsOpenAI TTS · OpenAI9,4 jt kredit4.000—
openai-tts-hdOpenAI TTS HD · OpenAI18,9 jt kredit4.000—
  • Billed per character (±1,000 characters ≈ 1 minute of audio), deducted from credits just like tokens. *Latest prices and voice list: GET /v1/audio/voices and GET /v1/audio/voices?model=<model>.
  • Cloned voices are created in Voice Studio (a voice sample + a consent recording from the voice's owner), then used with "voice": "clone:<id>". The clone fee is charged once, the first time that voice is used on an engine.
  • Dynamic pricing on our GPUs (voxcpm2, dots-tts): while a GPU is warm (busy) you pay only the per-minute price; a request that has to wake a sleeping GPU adds a one-off wake-up fee (wake_fee_rp in GET /v1/audio/voices) and its first audio takes ~2–3 minutes.
  • Style & pronunciation. Add "style": "narasi" (natural, narasi, iklan, santai, berita, edukasi — natural, narration, ad, casual, news, educational). Numbers, Rupiah, times, abbreviations, and terms like AI are read with Indonesian spelling automatically, including words in your account's pronunciation dictionary; send "normalize": false to pass the text through as is. Calibrated voices automatically use their best articulation settings when voice_settings is empty.
  • Formats: mp3 or wav. The response includes the x-classai-characters and x-classai-cost-micro-rp headers. Failed requests aren't charged.
  • Credits only. Voice is paid from your credit balance; token packages don't cover it. An API key limited to one model only works for that model — use an unrestricted key (or one limited to the voice model).
  • Errors: 400 empty or too-long text, 401 missing or wrong key, 402 not enough credits, 403 key limited to another model, 404 unknown model or cloned voice, 429 rate limit, 502/503 engine error or temporarily unavailable (not charged). Same JSON error shape as the chat endpoints.
  • Listeners must be told the audio is AI-generated. Imitating someone without permission or to deceive is prohibited — your account may be closed.

Images (image generation)

Create and edit images with the same key and credits: Google Nano Banana, OpenAI GPT Image, Microsoft MAI-Image, ByteDance Seedream and FLUX. The endpoints follow OpenAI's /v1/images/generations and /v1/images/edits, so the OpenAI SDK works as is. Billed per image that comes out; failed images aren't charged. Models marked ≈ are billed by the tokens they really use (the table shows the typical price). No-code version: Image Studio.

curl https://router.classai.id/v1/images/generations \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{"model":"nano-banana-2","prompt":"A minimalist poster for palm-sugar iced coffee","aspect_ratio":"4:5","resolution":"2K","response_format":"url"}'
FieldDescription
modelRequired. Model id from the table below.
promptRequired. What to draw (max 4,000 characters).
aspect_ratio1:1 · 4:5 · 3:4 · 2:3 · 9:16 · 4:3 · 3:2 · 16:9 · 21:9 (or send size like 1024x1536). GPT Image 1.x: 1:1 · 3:2 · 2:3 only.
resolution1K · 2K · 3K · 4K depending on the model (default: the smallest). On ≈ models a bigger size costs more.
qualityOfficial OpenAI models only (gpt-image-*, chatgpt-image): low · medium · high (default medium). Higher is sharper, slower and costs more.
nNumber of images, 1–4 (each is billed).
imageReference images to edit or stay consistent with: array of https URLs or data URIs (max 10 MB each). flux-kontext-pro/max need exactly 1 image (edit-only models); flux-1-dev is text only.
response_formatb64_json (default, plus url) or url (link valid for 24 hours).
modelNameCredits per imageOptionsTime
nano-banana-proNano Banana Pro · Google≈ 20 jt kredit–35,7 jt kredit1K · 2K · 4K15–40 s
nano-banana-2.1Nano Banana 2.1 · Google≈ 5,3 jt kredit–11,3 jt kredit1K · 2K · 4K10–25 s
nano-banana-2Nano Banana 2 · Google≈ 10 jt kredit–22,3 jt kredit1K · 2K · 4K10–25 s
nano-banana-2-liteNano Banana 2 Lite · Google≈ 5,3 jt kredit1K5–10 s
nano-bananaNano Banana · Google≈ 8 jt kredit1K8–15 s
gpt-image-2.5-flareGPT Image 2.5 Flare · OpenAI≈ 3,3 jt kredit–31,3 jt kredit1K · 2K · low · medium · high10–45 s
gpt-image-2.5-sunburstGPT Image 2.5 Sunburst · OpenAI≈ 3,3 jt kredit–31,3 jt kredit1K · 2K · low · medium · high15–150 s
gpt-image-2GPT Image 2 · OpenAI≈ 3,3 jt kredit–124 jt kredit1K · 2K · low · medium · high20–240 s
gpt-image-1.5GPT Image 1.5 · OpenAI≈ 3,3 jt kredit–27,3 jt kredit1K · low · medium · high8–60 s
chatgpt-imageChatGPT Image · OpenAI≈ 3,7 jt kredit–28,3 jt kredit1K · low · medium · high6–60 s
gpt-image-1GPT Image 1 · OpenAI≈ 3,3 jt kredit–33,7 jt kredit1K · low · medium · high10–60 s
gpt-image-1-miniGPT Image 1 Mini · OpenAI≈ 3,3 jt kredit–7 jt kredit1K · low · medium · high8–40 s
gpt-image-2.5GPT Image 2.5 Lite · OpenAI6,3 jt kredit1K · 2K · 4K30–150 s
mai-image-2.6MAI-Image 2.6 · Microsoft17 jt kredit1K20–40 s
mai-image-2.6-flashMAI-Image 2.6 Flash · Microsoft8,7 jt kredit1K12–20 s
seedream-5-proSeedream 5.0 Pro · ByteDance17 jt kredit1K · 2K110–140 s
seedream-5Seedream 5.0 · ByteDance7,3 jt kredit2K · 3K30–40 s
seedream-5-flashSeedream 5.0 Flash · ByteDance3,7 jt kredit1K · 2K15–20 s
seedream-4.5Seedream 4.5 · ByteDance8,3 jt kredit2K · 4K8–20 s
seedream-4Seedream 4.0 · ByteDance7,3 jt kredit1K · 2K · 4K7–15 s
flux-2-maxFLUX.2 Max · Black Forest Labs15 jt kredit1K · 2K8–15 s
flux-2-proFLUX.2 Pro · Black Forest Labs6,7 jt kredit1K · 2K5–10 s
flux-2-flexFLUX.2 Flex · Black Forest Labs12,7 jt kredit1K · 2K15–40 s
flux-2-kleinFLUX.2 Klein · Black Forest Labs3,3 jt kredit1K · 2K2–6 s
flux-1-devFLUX.1 Dev · Black Forest Labs4,3 jt kredit1K5–8 s
flux-kontext-maxFLUX Kontext Max · Black Forest Labs14,3 jt kredit1K · needs 1 image8–15 s
flux-kontext-proFLUX Kontext Pro · Black Forest Labs7,3 jt kredit1K · needs 1 image6–12 s

Videos (video generation)

Videos run as tasks: POST /v1/videos, then poll GET /v1/videos/{id} every ~10 seconds until status is completed (1–10 minutes depending on the model), then download from url or /v1/videos/{id}/content. Models: Google Veo 3.1, ByteDance Seedance, Alibaba Wan & HappyHorse, MiniMax H3 and Oxygen. Veo has one price per video; the others are priced per second by resolution (minimum $0.416 per video). Credits are held when it starts and only charged if the video comes out. No-code version: Video Studio.

# 1) Start
curl https://router.classai.id/v1/videos -H "Authorization: Bearer sk_live_…" -H "Content-Type: application/json" \
  -d '{"model":"veo-3.1-fast","prompt":"Drone over Bali rice terraces at sunrise, nature sounds","aspect_ratio":"9:16","resolution":"720p","seconds":"8"}'
# → {"id":"…","status":"in_progress"}

# 2) Poll until completed
curl https://router.classai.id/v1/videos/<id> -H "Authorization: Bearer sk_live_…"

# 3) Download
curl https://router.classai.id/v1/videos/<id>/content -H "Authorization: Bearer sk_live_…" --output video.mp4
FieldDescription
modelRequired. Model id from the table below.
promptRequired. Scene, camera movement and the sound you want (almost every model makes its own soundtrack).
aspect_ratio16:9 · 9:16 (all) · 1:1 · 4:3 · 3:4 (Seedance, Wan, HappyHorse, MiniMax) · 21:9 (Seedance, MiniMax).
resolution480p · 720p · 768p · 1080p depending on the model (default: the smallest). Veo 1080p is always 8 seconds.
secondsVeo: 4, 6 or 8 (default 8, same price). Other models: whole seconds within the model's range (see the table), priced per second.
input_referenceOptional: a start image / first frame (multipart file, https URL or data URI).
modelNameCredits per videoOptionsTime
veo-3.1-fastVeo 3.1 Fast · Google21 jt kredit/s · 720p25,3 jt kredit/s · 1080pmin. 33,3 jt kredit per video720p · 1080p · 4/6/8 s1–2 min
veo-3.1Veo 3.1 · Google84,2 jt kredit/s · 720p84,2 jt kredit/s · 1080pmin. 33,3 jt kredit per video720p · 1080p · 4/6/8 s1–3 min
seedance-2.5Seedance 2.5 · ByteDance21,6 jt kredit/s · 480p48,7 jt kredit/s · 720p123 jt kredit/s · 1080pmin. 33,3 jt kredit per video480p · 720p · 1080p · 4–30 s2–6 min
seedance-2.0Seedance 2.0 · ByteDance14,8 jt kredit/s · 480p31,8 jt kredit/s · 720p78,7 jt kredit/s · 1080pmin. 33,3 jt kredit per video480p · 720p · 1080p · 4–15 s2–3 min
seedance-2.0-fastSeedance 2.0 Fast · ByteDance9,4 jt kredit/s · 480p20,2 jt kredit/s · 720pmin. 33,3 jt kredit per video480p · 720p · 4–15 s1–3 min
seedance-2.0-miniSeedance 2.0 Mini · ByteDance7,4 jt kredit/s · 480p15,9 jt kredit/s · 720pmin. 33,3 jt kredit per video480p · 720p · 4–15 s1–2 min
wan-3.0Wan 3.0 · Alibaba7,4 jt kredit/s · 480p14,7 jt kredit/s · 720p29,5 jt kredit/s · 1080pmin. 33,3 jt kredit per video480p · 720p · 1080p · 2–30 s2–3 min
wan-3.0-primeWan 3.0 Prime · Alibaba12,6 jt kredit/s · 480p25,3 jt kredit/s · 720p50,6 jt kredit/s · 1080pmin. 33,3 jt kredit per video480p · 720p · 1080p · 2–30 s1–2 min
wan-2.7Wan 2.7 · Alibaba16,9 jt kredit/s · 720p21 jt kredit/s · 1080pmin. 33,3 jt kredit per video720p · 1080p · 2–15 s1–3 min
happyhorse-1.1HappyHorse 1.1 · Alibaba20,8 jt kredit/s · 720p31,5 jt kredit/s · 1080pmin. 33,3 jt kredit per video720p · 1080p · 3–15 s1–3 min
minimax-h3MiniMax H3 · MiniMax6 jt kredit/s · 768pmin. 33,3 jt kredit per video768p · 4–15 s3–10 min
oxygen-1.0Oxygen 1.0 · AZ84 jt kredit/s · 480p4 jt kredit/s · 768pmin. 33,3 jt kredit per video480p · 768p · 4–15 s1–3 min

Status: in_progress → completed (with a url valid for 24 hours) or failed (not charged). A video running longer than 45 minutes is cancelled and its credits come back. Latest models & prices (incl. price_per_second and price_estimate): GET /v1/media/models.

Embeddings, rerank & moderation

OpenAI format, same key and credits: POST /v1/embeddings (vectors for search & RAG), POST /v1/rerank (order documents by relevance to a query), and POST /v1/moderations (flag harmful content). Cost = tokens × the price per 1M tokens, rounded up. Failed requests are not charged.

curl https://router.classai.id/v1/embeddings -H "Authorization: Bearer sk_live_…" -H "Content-Type: application/json" \
  -d '{"model":"text-embedding-3-small","input":["AI class price","How to join a class"]}'
# → {"data":[{"index":0,"embedding":[…]},…],"usage":{"prompt_tokens":11,"total_tokens":11}}
FieldDescription
inputEmbeddings & moderation: a string or an array of strings (up to 2,048 per request).
dimensionsOptional, text-embedding-3-small/-large only: shorter vectors.
query · documentsRerank: the query + an array of strings (up to 1,000). Billed on total tokens (the query counts once per document).
top_nRerank, optional: how many top results to return (0 = all). Scores 0–1, best first.
modelEndpointPrice per 1M tokensNotes
text-embedding-3-small/v1/embeddings6,3 jt kreditEmbedding 3 Small · OpenAI · 1536 dims
text-embedding-3-large/v1/embeddings40,9 jt kreditEmbedding 3 Large · OpenAI · 3072 dims
text-embedding-ada-002/v1/embeddings31,4 jt kreditEmbedding Ada 002 · OpenAI · 1536 dims
bge-m3/v1/embeddings3,1 jt kreditBGE-M3 · BAAI · 1024 dims
bge-reranker-v2-m3/v1/rerank3,1 jt kreditBGE Reranker v2 M3 · BAAI
omni-moderation-latest/v1/moderations62,9 jt kreditOmni Moderation · OpenAI

Credits & token packages

All API keys in your account draw from the same source. For each request, the balance of a token package for that model is used first (single-model packages take priority over bundles); if there's no package or its tokens run out, the cost is deducted from credits. No special key per package or per model is needed.

Credits work for every model and are bought in packs: Pro 250M credits $4.99 · Max 500M credits $7.49 · Ultra 1B credits $11.99. Each purchase is valid for 30 days; the credits expiring soonest are used first, and whatever is left expires when the validity period ends. Balances bought before 10 October 2026 stay intact and never expire. Each model's credit rate per token is on the credits page.

Token packages are active for 30 days. Buying the same package again before it expires adds its tokens to what's left and extends it by 30 days from the previous end date. Once the active period ends, remaining tokens expire. Packages bought before 10 October 2026 keep working until used up, but can't be extended — new packages have their own quota.

Coding Plan (auto model)

Coding Plan is used through a single auto model. You don't pick a model: Classai automatically uses whichever model is fastest at the moment, and if one is having issues, another takes over within the same request.

PackageModel IDPicked from
Coding Plan UScoding-us-autoClaude Opus & Sonnet, Gemini, GPT-6, GPT-5.6, Muse Spark (Meta)
Coding Plan Chinacoding-china-autoDeepSeek, GLM, Kimi, MiniMax, Qwen
curl https://router.classai.id/v1/chat/completions   -H "Authorization: Bearer $CLASSAI_API_KEY"   -H "Content-Type: application/json"   -d '{"model": "coding-us-auto", "messages": [{"role": "user", "content": "Hello"}]}'

In Claude Code, opencode, Cursor, or other tools, just set the model name to coding-us-auto or coding-china-auto. Tokens are deducted from your Coding Plan quota. Other models (e.g. claude-opus-5) aren't part of Coding Plan — if called directly, they're paid from credits.

Error codes

Errors follow the OpenAI format: {"error": {"message", "type", "code"}}.

HTTPcodeMeaning
400invalid_request_error · unsupported_endpointThe body isn't valid JSON, a parameter was rejected by the model, or the model doesn't serve /v1/completions.
401missing_api_key · invalid_api_keyThe Authorization header is empty or the key is wrong.
402insufficient_balance · package_required · package_insufficientYou're out of credits and the model isn't covered by your package — buy credits or a package. Coding Plan only covers coding-us-auto / coding-china-auto; other models are paid from credits. Package-only models need an active package. package_insufficient: your package's remaining tokens aren't enough for this request (lower max_tokens, or add a package / credits).
403key_disabled · key_expired · account_disabledThe key is disabled/expired, or the account is suspended.
403model_not_allowedThis key is restricted to other models.
404model_not_foundThe model ID doesn't exist or is currently inactive. Check GET /v1/models.
413—The body is larger than 25 MB.
429rate_limited · concurrency_limitedToo many requests per minute, or too many concurrent requests on the Unlimited package.
502upstream_error · upstream_unreachableThe model engine is having issues. Safe to retry.
503maintenance · model_unavailableBrief maintenance, or every route for that model is down (rechecked automatically). Try again shortly or pick another model.

Tool integrations

Tools that support "OpenAI compatible" only need the base URL https://router.classai.id/v1. For Claude Code, use ANTHROPIC_BASE_URL without /v1 and pick a model from the catalog via ANTHROPIC_MODEL.

export ANTHROPIC_BASE_URL="https://router.classai.id"
export ANTHROPIC_AUTH_TOKEN="sk_live_…"
export ANTHROPIC_MODEL="claude-opus-5.5"
export ANTHROPIC_SMALL_FAST_MODEL="claude-opus-5.5"
claude

Using opencode? See the opencode prompt below — your API key and every model are already filled in, just copy & paste. The 9router section is only for people running their own 9router app — otherwise you can skip it.

Tools & CLI

How to set up Classai Router in popular tools — official download, install command, and setup steps one by one. Still stuck? Tap Ask Kai on the tool.

Code withkaiRecommended

Classai · CLI / terminal

Classai's own coding agent — terminal + Mac & Windows desktop. Sign in with Classai and go, no base URL to set.

Install · macOS / Linux
curl -fsSL https://withkai.im/install | bash
Install · Windows (PowerShell)
irm https://withkai.im/install.ps1 | iex
  1. 1Download the desktop app at withkai.im/download, or install the CLI with the command above.
  2. 2Open the app (or type withkai in your project folder), then Sign in with Classai — Prime and Premium keys are created for you.
  3. 3Start coding. Default is Classai Prime · Claude Sonnet 5.5; switch models in the model picker and top up credits right in the app.

Claude Code

Anthropic · CLI / terminal

Coding agent in your terminal — Anthropic format.

Install · macOS / Linux
curl -fsSL https://claude.ai/install.sh | bash
Install · Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex
  1. 1Install Claude Code, then set these environment variables (or put them in the "env" block of ~/.claude/settings.json):
  2. 2ANTHROPIC_BASE_URL = https://router.classai.id (no /v1) · ANTHROPIC_AUTH_TOKEN = your API key · ANTHROPIC_MODEL = claude-opus-5.5
  3. 3Run claude and check with /status.
Terminal (macOS / Linux)
export ANTHROPIC_BASE_URL="https://router.classai.id"
export ANTHROPIC_AUTH_TOKEN="API_KEY_KAMU"
export ANTHROPIC_MODEL="claude-opus-5.5"
claude

More examples in Tool integrations

OpenCode

OpenCode · CLI / terminal

Open-source coding agent, terminal and desktop.

Install · macOS / Linux
curl -fsSL https://opencode.ai/install | bash
Install · npm
npm install -g opencode-ai
  1. 1Download OpenCode (desktop) or install it from the terminal.
  2. 2Open Docs → opencode prompt in the dashboard and copy the prompt (your API key and every model are filled in).
  3. 3Paste it into OpenCode, then pick a Classai model with /models.

opencode prompt (key + models filled in)

Codex CLI

OpenAI · CLI / terminal

OpenAI's terminal coding agent — via the Responses API.

Install · npm
npm install -g @openai/codex
Install · macOS / Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh
  1. 1Install Codex, then create or edit ~/.codex/config.toml as below.
  2. 2Put your API key in the CLASSAI_API_KEY environment variable, then run codex.
~/.codex/config.toml
model = "claude-opus-5.5"
model_provider = "classai"

[model_providers.classai]
name = "Classai Router"
base_url = "https://router.classai.id/v1"
env_key = "CLASSAI_API_KEY"
wire_api = "responses"

Hermes Agent

Nous Research · CLI / terminal

A personal AI agent that gets tasks done for you.

Install · macOS / Linux
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
Install · Windows (PowerShell)
iex (irm https://hermes-agent.nousresearch.com/install.ps1)
  1. 1Install Hermes, then in a terminal (not inside a chat) run: hermes model
  2. 2Pick "Custom endpoint" and enter base URL https://router.classai.id/v1, your API key, and model claude-opus-5.5.
  3. 3Switch models any time in a session with /model custom:<model-id>.
~/.hermes/config.yaml
model:
  provider: custom
  base_url: https://router.classai.id/v1
  api_key: API_KEY_KAMU
  default: claude-opus-5.5

OpenClaw

OpenClaw · CLI / terminal

A personal AI assistant that runs on your computer and connects to your chats.

Install · macOS / Linux
curl -fsSL https://openclaw.ai/install.sh | bash
Install · Windows (PowerShell)
iwr -useb https://openclaw.ai/install.ps1 | iex
  1. 1Install OpenClaw, run onboarding and choose a custom API key / OpenAI-compatible.
  2. 2Enter base URL https://router.classai.id/v1, your API key and model claude-opus-5.5 — or write it straight into ~/.openclaw/openclaw.json as below.
~/.openclaw/openclaw.json
{
  models: {
    providers: {
      classai: {
        baseUrl: "https://router.classai.id/v1",
        apiKey: "API_KEY_KAMU",
        api: "openai-completions",
        models: [{ id: "claude-opus-5.5", name: "claude-opus-5.5" }],
      },
    },
  },
  agents: { defaults: { model: { primary: "classai/claude-opus-5.5" } } },
}

9router

9router · Local router

A local AI router on your laptop — combine Classai Router with other accounts.

Install · npm
npm install -g 9router && 9router
  1. 1Install and run 9router; its dashboard opens at http://localhost:20128.
  2. 2Add Classai Router as an OpenAI-compatible provider — follow the 9router guide in our docs.

Full 9router guide

Cursor

Anysphere · Code editor

A code editor with built-in AI.

  1. 1Open Cursor Settings → Models and paste your API key as the OpenAI API Key.
  2. 2Turn on Override OpenAI Base URL → https://router.classai.id/v1, then add the model claude-opus-5.5.
  3. 3Note: your own key works for chat only (not Tab), and Cursor's Plus plan doesn't allow your own keys.

More examples in Tool integrations

Cline

Cline · VS Code extension

Coding agent in VS Code (also a CLI).

Install · CLI
npm i -g cline
  1. 1Install the Cline extension from the VS Code Marketplace.
  2. 2Click the gear icon → API Provider: OpenAI Compatible.
  3. 3Base URL https://router.classai.id/v1, API Key = your API key, Model ID claude-opus-5.5.

Kilo Code

Kilo · VS Code extension

Coding agent for VS Code and the terminal.

Install · CLI
npm install -g @kilocode/cli
  1. 1Install Kilo Code from the VS Code Marketplace (or its CLI).
  2. 2Settings (gear) → Providers tab → Custom provider, Provider API: OpenAI Compatible.
  3. 3Base URL https://router.classai.id/v1, enter your API key — the model list loads by itself. Submit.

Aider

Aider · CLI / terminal

AI pair programming right in your terminal.

Install · macOS / Linux
curl -LsSf https://aider.chat/install.sh | sh
Install · Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"
  1. 1Install Aider, then set the base URL and API key in your terminal.
  2. 2Run aider with openai/ in front of the model name.
Terminal (macOS / Linux)
export OPENAI_API_BASE="https://router.classai.id/v1"
export OPENAI_API_KEY="API_KEY_KAMU"
aider --model openai/claude-opus-5.5

Chatbox

Chatbox AI · Chat app

AI chat app for desktop & phone — the easiest start.

  1. 1Download Chatbox, open Settings → Model Provider → Add.
  2. 2Choose OpenAI API compatible. API Host: https://router.classai.id (no /v1), leave API Path empty.
  3. 3Enter your API key, add the model claude-opus-5.5, Save, then click Check.

n8n

n8n · Automation

Automations & chatbots with little code.

Install · npm
npx n8n
  1. 1Create an OpenAI credential: API Key = your API key, Base URL = https://router.classai.id/v1.
  2. 2Use that credential in the OpenAI Chat Model node and set the model claude-opus-5.5.

More examples in Tool integrations

opencode prompt

One prompt that sets up Classai Router and all its models in opencode. Copy, paste into opencode (or another AI coding agent), done — your existing config stays safe.

This prompt contains your API key, so it only shows after you sign in. Sign in to the dashboard then open Documentation → opencode prompt.

Connect to 9router (optional)

Tidak menjalankan aplikasi 9router? Lewati bagian ini.

Claude Code, Cursor, Cline, opencode, dan tool lain cukup diisi Base URL https://router.classai.id/v1 dan API key Classai sk_live_… — tanpa localhost, tanpa key 9router.

Lihat Integrasi tools →

Sudah menjalankan 9router di komputermu?

9router adalah aplikasi router AI yang kamu jalankan sendiri. Tambahkan Classai Router sebagai salah satu provider-nya — semua model Classai bisa dipakai dari 9router, termasuk sebagai cadangan di combo.

Alurnya lewat 9router

Tool kamuClaude Code, Cursor, opencode…
pakai API key 9router
9router (di komputermu)localhost:20128
pakai API key Classai
Classai Routerrouter.classai.id
  • localhost:20128 = alamat aplikasi 9router di komputermu sendiri (port bawaannya), bukan server Classai. Kalau 9router tidak sedang berjalan, alamat itu memang tidak bisa dibuka.
  • Ada dua key. Key Classai sk_live_… dipasang sekali di 9router (langkah 3). Tool-mu bicara ke 9router, jadi tool memakai key milik 9router — bukan key Classai.
  • Pilih salah satu jalur per tool. Kalau tool sudah tersambung langsung ke Classai Router, jangan ditambah lewat 9router juga — modelnya akan muncul dobel (mis. claude-opus-5.5 dan classai/claude-opus-5.5).

Langkah memasang Classai di 9router

Untuk yang menjalankan 9router — salin isian di tiap langkah.

  1. 1

    Buka Providers → Add OpenAI Compatible

    Jalankan 9router (npx 9router), buka dashboard http://localhost:20128/dashboard, masuk ke Providers, lalu klik Add OpenAI Compatible.

    Lebih suka format Anthropic (mis. untuk Claude Code)? Pilih Add Anthropic Compatible — isiannya sama, 9router menambahkan /messages sendiri.

  2. 2

    Isi form provider

    Add OpenAI Compatible9router
    Name
    Classai Router
    Prefix
    classai

    Dipakai di ID model: classai/<model>

    Base URL
    https://router.classai.id/v1

    Harus diakhiri /v1.

    API Type
    Chat Completions

    Simpan.

  3. 3

    Add Connection → tempel API key

    Buka provider Classai Router yang baru dibuat → Add Connection → beri nama (mis. utama) → tempel API key sk_live_… dari menu API Keys → Test Connection sampai statusnya hijau.

  4. 4

    Add Model — daftarkan model Classai

    Klik Add Model dan isi ID model persis seperti di bawah. Pilih model yang mau dipakai lalu klik Salin di barisnya — satu model satu kali Add Model — atau Salin semua. Format ID model untuk Add Model di 9router; format classai/ID untuk dipanggil dari tool (langkah 5).

    • Claude Opus 5.5claude-opus-5.5
    • Claude Sonnet 5.5claude-sonnet-5.5
    • Claude Opus 5claude-opus-5
    • Claude Sonnet 5claude-sonnet-5
    • GLM 5.3glm-5.3
    • DeepSeek V4.1 Flashdeepseek-v4.1-flash
    • Kimi K3kimi-k3
    • Claude Sonnet 4.6claude-sonnet-4.6

    Daftar ini hanya model yang sedang aktif dijual. Harga & konteks tiap model ada di Katalog Model (atau GET /v1/models).

  5. 5

    Pakai dengan prefix classai/

    Di tool yang diarahkan ke 9router (Base URL http://localhost:20128/v1), pilih model classai/claude-opus-5.5. Isi API key dengan key milik 9router (dari dashboard 9router), bukan sk_live_… — key Classai sudah kamu pasang di langkah 3, dan 9router yang meneruskannya ke Classai Router.

    curl http://localhost:20128/v1/chat/completions \
      -H "Authorization: Bearer <API key 9router>" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "classai/claude-opus-5.5",
        "messages": [{"role": "user", "content": "Halo dari 9router!"}]
      }'
  6. 6

    (Opsional) Jadikan cadangan di combo

    Di Combos, buka atau buat combo lalu Add Model to Combo → classai/claude-opus-5.5. Kalau provider lain kena limit atau error, 9router otomatis pindah ke Classai Router.

Biaya tetap dihitung di Classai: request lewat 9router memakai paket token yang aktif dulu, lalu kredit — semuanya tercatat di menu Pemakaian.

Limits

  • 60 requests per minute per API key, and 180 per account (all keys and the playground together). Enterprise accounts: 1,000 per key and 3,000 per account. Every chat answer carries x-ratelimit-limit-requests / x-ratelimit-remaining-requests (per key) and the same with -account; GET /v1/account shows your limits. A 429 carries Retry-After (seconds).
  • No limit on requests at once, except on the Unlimited package below.
  • Input tokens are billed up to what your request holds (system, messages, tools, images) — prompts added on the way are never billed.
  • Unlimited package (fair use): 60 requests per minute and at most 5 concurrent requests per account — all keys and the playground count together.
  • Request body up to 25 MB; a single request can run up to 15 minutes.
  • Up to 25 API keys per account (including the default key and forks); Enterprise up to 500.

Full terms on billing, packages, fair use, and refunds are in the Terms & Conditions and Privacy Policy.