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.
Quick start
Base URL:
https://router.classai.id/v1Copy 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 & path | Format |
|---|---|
| POST /v1/chat/completions | OpenAI Chat Completions (messages, tools, stream) |
| POST /v1/messages | Anthropic Messages (Claude Code, Anthropic SDK) |
| POST /v1/completions | OpenAI legacy completions |
| GET /v1/models | Active 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 ID | Context | Input / 1M | Output / 1M |
|---|---|---|---|
| 1M | 52,8 jt kredit | 264 jt kredit | |
| 1M | 26,4 jt kredit | 132 jt kredit | |
| 200K | 66 jt kredit | 330 jt kredit | |
| 200K | 26,4 jt kredit | 132 jt kredit | |
| 200K | 39,6 jt kredit | 198 jt kredit | |
| 200K | 6,6 jt kredit | 33 jt kredit | |
| 1M | 10,8 jt kredit | 33 jt kredit | |
| 1M | 12,5 jt kredit | 61,6 jt kredit | |
| 1M | 8,3 jt kredit | 30,3 jt kredit | |
| 1M | 7,7 jt kredit | 28 jt kredit | |
| 256K | 19,8 jt kredit | 99 jt kredit | |
| 1M | 12,3 jt kredit | 61,6 jt kredit | |
| 1M | 6 jt kredit | 23,1 jt kredit | |
| 250K | 8,4 jt kredit | 41,8 jt kredit | |
| 200K | 5,3 jt kredit | 13,2 jt kredit | |
| 1M | 7,7 jt kredit | 30,9 jt kredit | |
| 1M | 7,2 jt kredit | 27,5 jt kredit | |
| 1M | 20,9 jt kredit | 55 jt kredit | |
| 1M | 21,4 jt kredit | 55 jt kredit | |
| 1M | 7,4 jt kredit | 30,8 jt kredit | |
| 200K | 12,3 jt kredit | 61,6 jt kredit | |
| 256K | 8,4 jt kredit | 41,8 jt kredit | |
| 1M | 14 jt kredit | 56 jt kredit | |
| 200K | 66 jt kredit | 330 jt kredit | |
| 400K | 66 jt kredit | 330 jt kredit | |
| 400K | 34,2 jt kredit | 110 jt kredit | |
| 1M | 34,2 jt kredit | 110 jt kredit | |
| 1.1M | 34,2 jt kredit | 100 jt kredit | |
| 1M | 28,8 jt kredit | 82,5 jt kredit | |
| 1M | 9 jt kredit | 43,6 jt kredit | |
| 1M | 12,4 jt kredit | 61,9 jt kredit | |
| 1M | 13,2 jt kredit | 66 jt kredit | |
| 1M | 66 jt kredit | 330 jt kredit | |
| 1M | 12,5 jt kredit | 61,6 jt kredit | |
| 200K | 30 jt kredit | 150 jt kredit | |
| 1M | 12,4 jt kredit | 61,9 jt kredit | |
| 500K | 21,1 jt kredit | 66 jt kredit | |
| 256K | 9,9 jt kredit | 49,5 jt kredit | |
| 1M | 9,8 jt kredit | 48,7 jt kredit | |
| 1M | 5,4 jt kredit | 24,7 jt kredit | |
| 200K | 66 jt kredit | 330 jt kredit | |
| 1M | 0 kredit | 0 kredit | |
| — | 0 kredit | 0 kredit | |
| — | 0 kredit | 0 kredit | |
| — | 0 kredit | 0 kredit | |
| 1M | 0 kredit | 0 kredit | |
| 1M | 0 kredit | 0 kredit | |
| 1M | 0 kredit | 0 kredit | |
| 256K | 0 kredit | 0 kredit | |
| 256K | 0 kredit | 0 kredit | |
| 262K | 0 kredit | 0 kredit | |
| 262K | 0 kredit | 0 kredit | |
| 512K | 0 kredit | 0 kredit | |
| 262K | 0 kredit | 0 kredit | |
| 262K | 0 kredit | 0 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_controlmarker 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.
| Mode | What's redacted | Header |
|---|---|---|
| Standard (default) | 16-digit NIK (Indonesian ID number) → [NIK disensor], payment card numbers → [nomor kartu disensor] | — (no header) |
| Strict | All of the above + email addresses and Indonesian phone numbers | x-classai-pii: strict |
| Off | Nothing (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| Field | Description |
|---|---|
model | Required. Engine id from the table below. |
input | Required. The text to read, up to the engine's Max characters. |
voice | Required. A voice id from GET /v1/audio/voices?model=<model>, or clone:<id> for your cloned voice. |
response_format | mp3 (default) or wav. |
speed | 0.7–1.2 (default 1, or the calibrated voice's best pace). |
style | natural · narasi · iklan · santai · berita · edukasi (natural, narration, ad, casual, news, educational). |
normalize | false = send the text as is (no automatic Indonesian spelling or dictionary). |
voice_settings | Optional: 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_…"| model | Engine | Credits per minute* | Max characters | Clone |
|---|---|---|---|---|
voxcpm2 | VoxCPM2 · OpenBMB | 5,3 jt kredit | 5.000 | 33,3 jt kredit one-time |
dots-tts | dots.tts · rednote | 5,3 jt kredit | 5.000 | 33,3 jt kredit one-time |
elevenlabs-v4 | Eleven v4 · ElevenLabs | 28 jt kredit | 5.000 | 100 jt kredit one-time |
elevenlabs-v4-turbo | Eleven v4 Turbo · ElevenLabs | 14 jt kredit | 5.000 | 100 jt kredit one-time |
elevenlabs-flash | Eleven Flash v2.5 · ElevenLabs | 14 jt kredit | 5.000 | 100 jt kredit one-time |
elevenlabs-v2 | Eleven Multilingual v2 · ElevenLabs | 28 jt kredit | 5.000 | 100 jt kredit one-time |
openai-tts | OpenAI TTS · OpenAI | 9,4 jt kredit | 4.000 | — |
openai-tts-hd | OpenAI TTS HD · OpenAI | 18,9 jt kredit | 4.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/voicesandGET /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_rpinGET /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": falseto pass the text through as is. Calibrated voices automatically use their best articulation settings whenvoice_settingsis empty. - Formats:
mp3orwav. The response includes thex-classai-charactersandx-classai-cost-micro-rpheaders. 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:
400empty or too-long text,401missing or wrong key,402not enough credits,403key limited to another model,404unknown model or cloned voice,429rate limit,502/503engine 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"}'| Field | Description |
|---|---|
model | Required. Model id from the table below. |
prompt | Required. What to draw (max 4,000 characters). |
aspect_ratio | 1: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. |
resolution | 1K · 2K · 3K · 4K depending on the model (default: the smallest). On ≈ models a bigger size costs more. |
quality | Official OpenAI models only (gpt-image-*, chatgpt-image): low · medium · high (default medium). Higher is sharper, slower and costs more. |
n | Number of images, 1–4 (each is billed). |
image | Reference 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_format | b64_json (default, plus url) or url (link valid for 24 hours). |
| model | Name | Credits per image | Options | Time |
|---|---|---|---|---|
nano-banana-pro | Nano Banana Pro · Google | ≈ 20 jt kredit–35,7 jt kredit | 1K · 2K · 4K | 15–40 s |
nano-banana-2.1 | Nano Banana 2.1 · Google | ≈ 5,3 jt kredit–11,3 jt kredit | 1K · 2K · 4K | 10–25 s |
nano-banana-2 | Nano Banana 2 · Google | ≈ 10 jt kredit–22,3 jt kredit | 1K · 2K · 4K | 10–25 s |
nano-banana-2-lite | Nano Banana 2 Lite · Google | ≈ 5,3 jt kredit | 1K | 5–10 s |
nano-banana | Nano Banana · Google | ≈ 8 jt kredit | 1K | 8–15 s |
gpt-image-2.5-flare | GPT Image 2.5 Flare · OpenAI | ≈ 3,3 jt kredit–31,3 jt kredit | 1K · 2K · low · medium · high | 10–45 s |
gpt-image-2.5-sunburst | GPT Image 2.5 Sunburst · OpenAI | ≈ 3,3 jt kredit–31,3 jt kredit | 1K · 2K · low · medium · high | 15–150 s |
gpt-image-2 | GPT Image 2 · OpenAI | ≈ 3,3 jt kredit–124 jt kredit | 1K · 2K · low · medium · high | 20–240 s |
gpt-image-1.5 | GPT Image 1.5 · OpenAI | ≈ 3,3 jt kredit–27,3 jt kredit | 1K · low · medium · high | 8–60 s |
chatgpt-image | ChatGPT Image · OpenAI | ≈ 3,7 jt kredit–28,3 jt kredit | 1K · low · medium · high | 6–60 s |
gpt-image-1 | GPT Image 1 · OpenAI | ≈ 3,3 jt kredit–33,7 jt kredit | 1K · low · medium · high | 10–60 s |
gpt-image-1-mini | GPT Image 1 Mini · OpenAI | ≈ 3,3 jt kredit–7 jt kredit | 1K · low · medium · high | 8–40 s |
gpt-image-2.5 | GPT Image 2.5 Lite · OpenAI | 6,3 jt kredit | 1K · 2K · 4K | 30–150 s |
mai-image-2.6 | MAI-Image 2.6 · Microsoft | 17 jt kredit | 1K | 20–40 s |
mai-image-2.6-flash | MAI-Image 2.6 Flash · Microsoft | 8,7 jt kredit | 1K | 12–20 s |
seedream-5-pro | Seedream 5.0 Pro · ByteDance | 17 jt kredit | 1K · 2K | 110–140 s |
seedream-5 | Seedream 5.0 · ByteDance | 7,3 jt kredit | 2K · 3K | 30–40 s |
seedream-5-flash | Seedream 5.0 Flash · ByteDance | 3,7 jt kredit | 1K · 2K | 15–20 s |
seedream-4.5 | Seedream 4.5 · ByteDance | 8,3 jt kredit | 2K · 4K | 8–20 s |
seedream-4 | Seedream 4.0 · ByteDance | 7,3 jt kredit | 1K · 2K · 4K | 7–15 s |
flux-2-max | FLUX.2 Max · Black Forest Labs | 15 jt kredit | 1K · 2K | 8–15 s |
flux-2-pro | FLUX.2 Pro · Black Forest Labs | 6,7 jt kredit | 1K · 2K | 5–10 s |
flux-2-flex | FLUX.2 Flex · Black Forest Labs | 12,7 jt kredit | 1K · 2K | 15–40 s |
flux-2-klein | FLUX.2 Klein · Black Forest Labs | 3,3 jt kredit | 1K · 2K | 2–6 s |
flux-1-dev | FLUX.1 Dev · Black Forest Labs | 4,3 jt kredit | 1K | 5–8 s |
flux-kontext-max | FLUX Kontext Max · Black Forest Labs | 14,3 jt kredit | 1K · needs 1 image | 8–15 s |
flux-kontext-pro | FLUX Kontext Pro · Black Forest Labs | 7,3 jt kredit | 1K · needs 1 image | 6–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| Field | Description |
|---|---|
model | Required. Model id from the table below. |
prompt | Required. Scene, camera movement and the sound you want (almost every model makes its own soundtrack). |
aspect_ratio | 16:9 · 9:16 (all) · 1:1 · 4:3 · 3:4 (Seedance, Wan, HappyHorse, MiniMax) · 21:9 (Seedance, MiniMax). |
resolution | 480p · 720p · 768p · 1080p depending on the model (default: the smallest). Veo 1080p is always 8 seconds. |
seconds | Veo: 4, 6 or 8 (default 8, same price). Other models: whole seconds within the model's range (see the table), priced per second. |
input_reference | Optional: a start image / first frame (multipart file, https URL or data URI). |
| model | Name | Credits per video | Options | Time |
|---|---|---|---|---|
veo-3.1-fast | Veo 3.1 Fast · Google | 21 jt kredit/s · 720p25,3 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 720p · 1080p · 4/6/8 s | 1–2 min |
veo-3.1 | Veo 3.1 · Google | 84,2 jt kredit/s · 720p84,2 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 720p · 1080p · 4/6/8 s | 1–3 min |
seedance-2.5 | Seedance 2.5 · ByteDance | 21,6 jt kredit/s · 480p48,7 jt kredit/s · 720p123 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 480p · 720p · 1080p · 4–30 s | 2–6 min |
seedance-2.0 | Seedance 2.0 · ByteDance | 14,8 jt kredit/s · 480p31,8 jt kredit/s · 720p78,7 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 480p · 720p · 1080p · 4–15 s | 2–3 min |
seedance-2.0-fast | Seedance 2.0 Fast · ByteDance | 9,4 jt kredit/s · 480p20,2 jt kredit/s · 720pmin. 33,3 jt kredit per video | 480p · 720p · 4–15 s | 1–3 min |
seedance-2.0-mini | Seedance 2.0 Mini · ByteDance | 7,4 jt kredit/s · 480p15,9 jt kredit/s · 720pmin. 33,3 jt kredit per video | 480p · 720p · 4–15 s | 1–2 min |
wan-3.0 | Wan 3.0 · Alibaba | 7,4 jt kredit/s · 480p14,7 jt kredit/s · 720p29,5 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 480p · 720p · 1080p · 2–30 s | 2–3 min |
wan-3.0-prime | Wan 3.0 Prime · Alibaba | 12,6 jt kredit/s · 480p25,3 jt kredit/s · 720p50,6 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 480p · 720p · 1080p · 2–30 s | 1–2 min |
wan-2.7 | Wan 2.7 · Alibaba | 16,9 jt kredit/s · 720p21 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 720p · 1080p · 2–15 s | 1–3 min |
happyhorse-1.1 | HappyHorse 1.1 · Alibaba | 20,8 jt kredit/s · 720p31,5 jt kredit/s · 1080pmin. 33,3 jt kredit per video | 720p · 1080p · 3–15 s | 1–3 min |
minimax-h3 | MiniMax H3 · MiniMax | 6 jt kredit/s · 768pmin. 33,3 jt kredit per video | 768p · 4–15 s | 3–10 min |
oxygen-1.0 | Oxygen 1.0 · AZ8 | 4 jt kredit/s · 480p4 jt kredit/s · 768pmin. 33,3 jt kredit per video | 480p · 768p · 4–15 s | 1–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}}| Field | Description |
|---|---|
input | Embeddings & moderation: a string or an array of strings (up to 2,048 per request). |
dimensions | Optional, text-embedding-3-small/-large only: shorter vectors. |
query · documents | Rerank: the query + an array of strings (up to 1,000). Billed on total tokens (the query counts once per document). |
top_n | Rerank, optional: how many top results to return (0 = all). Scores 0–1, best first. |
| model | Endpoint | Price per 1M tokens | Notes |
|---|---|---|---|
text-embedding-3-small | /v1/embeddings | 6,3 jt kredit | Embedding 3 Small · OpenAI · 1536 dims |
text-embedding-3-large | /v1/embeddings | 40,9 jt kredit | Embedding 3 Large · OpenAI · 3072 dims |
text-embedding-ada-002 | /v1/embeddings | 31,4 jt kredit | Embedding Ada 002 · OpenAI · 1536 dims |
bge-m3 | /v1/embeddings | 3,1 jt kredit | BGE-M3 · BAAI · 1024 dims |
bge-reranker-v2-m3 | /v1/rerank | 3,1 jt kredit | BGE Reranker v2 M3 · BAAI |
omni-moderation-latest | /v1/moderations | 62,9 jt kredit | Omni 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.
| Package | Model ID | Picked from |
|---|---|---|
| Coding Plan US | coding-us-auto | Claude Opus & Sonnet, Gemini, GPT-6, GPT-5.6, Muse Spark (Meta) |
| Coding Plan China | coding-china-auto | DeepSeek, 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"}}.
| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_request_error · unsupported_endpoint | The body isn't valid JSON, a parameter was rejected by the model, or the model doesn't serve /v1/completions. |
| 401 | missing_api_key · invalid_api_key | The Authorization header is empty or the key is wrong. |
| 402 | insufficient_balance · package_required · package_insufficient | You'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). |
| 403 | key_disabled · key_expired · account_disabled | The key is disabled/expired, or the account is suspended. |
| 403 | model_not_allowed | This key is restricted to other models. |
| 404 | model_not_found | The model ID doesn't exist or is currently inactive. Check GET /v1/models. |
| 413 | — | The body is larger than 25 MB. |
| 429 | rate_limited · concurrency_limited | Too many requests per minute, or too many concurrent requests on the Unlimited package. |
| 502 | upstream_error · upstream_unreachable | The model engine is having issues. Safe to retry. |
| 503 | maintenance · model_unavailable | Brief 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"
claudeUsing 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.
curl -fsSL https://withkai.im/install | bashirm https://withkai.im/install.ps1 | iex- 1Download the desktop app at withkai.im/download, or install the CLI with the command above.
- 2Open the app (or type withkai in your project folder), then Sign in with Classai — Prime and Premium keys are created for you.
- 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.
curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iex- 1Install Claude Code, then set these environment variables (or put them in the "env" block of ~/.claude/settings.json):
- 2ANTHROPIC_BASE_URL = https://router.classai.id (no /v1) · ANTHROPIC_AUTH_TOKEN = your API key · ANTHROPIC_MODEL = claude-opus-5.5
- 3Run claude and check with /status.
export ANTHROPIC_BASE_URL="https://router.classai.id"
export ANTHROPIC_AUTH_TOKEN="API_KEY_KAMU"
export ANTHROPIC_MODEL="claude-opus-5.5"
claudeOpenCode
OpenCode · CLI / terminal
Open-source coding agent, terminal and desktop.
curl -fsSL https://opencode.ai/install | bashnpm install -g opencode-ai- 1Download OpenCode (desktop) or install it from the terminal.
- 2Open Docs → opencode prompt in the dashboard and copy the prompt (your API key and every model are filled in).
- 3Paste it into OpenCode, then pick a Classai model with /models.
Codex CLI
OpenAI · CLI / terminal
OpenAI's terminal coding agent — via the Responses API.
npm install -g @openai/codexcurl -fsSL https://chatgpt.com/codex/install.sh | sh- 1Install Codex, then create or edit ~/.codex/config.toml as below.
- 2Put your API key in the CLASSAI_API_KEY environment variable, then run codex.
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.
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bashiex (irm https://hermes-agent.nousresearch.com/install.ps1)- 1Install Hermes, then in a terminal (not inside a chat) run: hermes model
- 2Pick "Custom endpoint" and enter base URL https://router.classai.id/v1, your API key, and model claude-opus-5.5.
- 3Switch models any time in a session with /model custom:<model-id>.
model:
provider: custom
base_url: https://router.classai.id/v1
api_key: API_KEY_KAMU
default: claude-opus-5.5OpenClaw
OpenClaw · CLI / terminal
A personal AI assistant that runs on your computer and connects to your chats.
curl -fsSL https://openclaw.ai/install.sh | bashiwr -useb https://openclaw.ai/install.ps1 | iex- 1Install OpenClaw, run onboarding and choose a custom API key / OpenAI-compatible.
- 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.
{
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.
npm install -g 9router && 9router- 1Install and run 9router; its dashboard opens at http://localhost:20128.
- 2Add Classai Router as an OpenAI-compatible provider — follow the 9router guide in our docs.
Cursor
Anysphere · Code editor
A code editor with built-in AI.
- 1Open Cursor Settings → Models and paste your API key as the OpenAI API Key.
- 2Turn on Override OpenAI Base URL → https://router.classai.id/v1, then add the model claude-opus-5.5.
- 3Note: your own key works for chat only (not Tab), and Cursor's Plus plan doesn't allow your own keys.
Cline
Cline · VS Code extension
Coding agent in VS Code (also a CLI).
npm i -g cline- 1Install the Cline extension from the VS Code Marketplace.
- 2Click the gear icon → API Provider: OpenAI Compatible.
- 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.
npm install -g @kilocode/cli- 1Install Kilo Code from the VS Code Marketplace (or its CLI).
- 2Settings (gear) → Providers tab → Custom provider, Provider API: OpenAI Compatible.
- 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.
curl -LsSf https://aider.chat/install.sh | shpowershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"- 1Install Aider, then set the base URL and API key in your terminal.
- 2Run aider with openai/ in front of the model name.
export OPENAI_API_BASE="https://router.classai.id/v1"
export OPENAI_API_KEY="API_KEY_KAMU"
aider --model openai/claude-opus-5.5Chatbox
Chatbox AI · Chat app
AI chat app for desktop & phone — the easiest start.
- 1Download Chatbox, open Settings → Model Provider → Add.
- 2Choose OpenAI API compatible. API Host: https://router.classai.id (no /v1), leave API Path empty.
- 3Enter your API key, add the model claude-opus-5.5, Save, then click Check.
n8n
n8n · Automation
Automations & chatbots with little code.
npx n8n- 1Create an OpenAI credential: API Key = your API key, Base URL = https://router.classai.id/v1.
- 2Use that credential in the OpenAI Chat Model node and set the model claude-opus-5.5.
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.
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
- 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.5danclassai/claude-opus-5.5).
Langkah memasang Classai di 9router
Untuk yang menjalankan 9router — salin isian di tiap langkah.
- 1
Buka Providers → Add OpenAI Compatible
Jalankan 9router (
npx 9router), buka dashboardhttp://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
/messagessendiri. - 2
Isi form provider
Add OpenAI Compatible9routerNameClassai RouterPrefixclassaiDipakai di ID model: classai/<model>
Base URLhttps://router.classai.id/v1Harus diakhiri /v1.
API TypeChat CompletionsSimpan.
- 3
Add Connection → tempel API key
Buka provider Classai Router yang baru dibuat → Add Connection → beri nama (mis.
utama) → tempel API keysk_live_…dari menu API Keys → Test Connection sampai statusnya hijau. - 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 modeluntuk Add Model di 9router; formatclassai/IDuntuk dipanggil dari tool (langkah 5).Claude Opus 5.5
claude-opus-5.5Claude Sonnet 5.5
claude-sonnet-5.5Claude Opus 5
claude-opus-5Claude Sonnet 5
claude-sonnet-5GLM 5.3
glm-5.3DeepSeek V4.1 Flash
deepseek-v4.1-flashKimi K3
kimi-k3Claude Sonnet 4.6
claude-sonnet-4.6
Daftar ini hanya model yang sedang aktif dijual. Harga & konteks tiap model ada di Katalog Model (atau
GET /v1/models). - 5
Pakai dengan prefix
classai/Di tool yang diarahkan ke 9router (Base URL
http://localhost:20128/v1), pilih modelclassai/claude-opus-5.5. Isi API key dengan key milik 9router (dari dashboard 9router), bukansk_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
(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/accountshows yourlimits. A429carriesRetry-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.