Docs
TokenCLI speaks the OpenAI chat completions format. Anything built on the OpenAI SDK works once it points at the gateway.
Quickstart
Create an account, top up, then create a key. The key is shown once, so store it when you see it.
from openai import OpenAIclient = OpenAI(base_url="https://api.tokencli.dev/v1",api_key="sk-tg-...",)client.chat.completions.create(model="gpt-6.1-sol",messages=[{"role": "user", "content": "Hello"}],)Only the highlighted lines change.
Models and rates
USD per 1 million tokens. Use the ID in the model field.
| Model and ID | Input | Cached | Output |
|---|---|---|---|
| DeepSeek V4.1 Flash 1017deepseek-v4.1-flash-1017 | $0.06 | $0.006 | $0.24 |
| GLM 5.3glm-5.3 | $0.56 | $0.156 | $1.76 |
| GPT-6.1 Solgpt-6.1-sol | $0.80 | $0.08 | $4.00 |
| Gemini 4 Argongemini-4-argon | $0.80 | $0.08 | $4.00 |
| Kimi K3.1 Prokimi-k3.1-pro | $0.90 | $0.12 | $4.00 |
| GPT-6 Astragpt-6-astra | $4.00 | $0.60 | $20.00 |
| Claude Opus 5.5claude-opus-5.5 | $2.10 | $0.14 | $8.00 |
| DeepSeek V4.1 Flashdeepseek-v4.1-flash | $0.06 | $0.006 | $0.24 |
| GLM 5.3 Flash Uncensoredglm-5.3-flash-uncensored | $0.075 | $0.018 | $0.20 |
| GLM 5.3 Flashglm-5.3-flash | $0.075 | $0.018 | $0.20 |
| MiMo V2.6 Flashmimo-v2.6-flash | $0.09 | $0.004 | $0.11 |
| DeepSeek V4 Flashdeepseek-v4-flash | $0.09 | $0.0054 | $0.24 |
| DeepSeek V4.1 Flash 1017 HQdeepseek-v4.1-flash-1017-hq | $0.15 | $0.02 | $0.24 |
| MiMo V2.6 Promimo-v2.6-pro | $0.30 | $0.006 | $0.35 |
| DeepSeek V4.1 Flash Abliterateddeepseek-v4.1-flash-abliterated | $0.30 | $0.10 | $0.50 |
| DeepSeek V4 Pro Uncensoreddeepseek-v4-pro-uncensored | $0.52 | $0.10 | $0.79 |
| DeepSeek V4 Prodeepseek-v4-pro | $0.52 | $0.10 | $0.79 |
| GLM 5.3 Uncensoredglm-5.3-uncensored | $0.56 | $0.156 | $1.76 |
| GLM 5.2glm-5.2 | $0.56 | $0.156 | $1.76 |
| Grok 4.5grok-4.5 | $0.80 | $0.30 | $2.40 |
| GPT-6 Solgpt-6-sol | $0.80 | $0.12 | $4.00 |
| Grok 4.7grok-4.7 | $0.80 | $0.30 | $2.40 |
| Kimi K3kimi-k3 | $1.20 | $0.18 | $6.00 |
| GLM 5.3 Abliteratedglm-5.3-abliterated | $1.30 | $0.32 | $3.50 |
| GPT-5.6 Terragpt-5.6-terra | $1.35 | $0.12 | $4.80 |
| DeepSeek V4.1 Flash Abliterated Fastdeepseek-v4.1-flash-abliterated-fast | $1.40 | $0.32 | $2.10 |
| Gemini 4 Carbongemini-4-carbon | $1.50 | $0.10 | $4.00 |
| GPT-5.6 Solgpt-5.6-sol | $1.60 | $0.24 | $8.00 |
| GPT-6.2 Solgpt-6.2-sol | $1.80 | $0.12 | $4.00 |
| Claude Opus 4.6claude-opus-4.6 | $2.00 | $0.30 | $10.00 |
| Claude Opus 4.7claude-opus-4.7 | $2.00 | $0.30 | $10.00 |
| Claude Opus 4.8claude-opus-4.8 | $2.00 | $0.30 | $10.00 |
| GPT-5.5gpt-5.5 | $2.00 | $0.30 | $12.00 |
| Claude Opus 5.5 Maxclaude-opus-5.5-max | $2.40 | $0.16 | $8.00 |
How billing works
Before a request is forwarded, the most it could cost is held against your balance: all input uncached, plus max_tokens of output. If you do not set max_tokens, a default cap for the model is applied. When the response finishes, you pay for actual usage and the rest of the hold is released.
Input served from cache is billed at the cached rate. Reasoning tokens are billed once, as output. If the model provider fails before any output, you are not charged.
If a stream is cut before usage is reported, including when your client disconnects, delivered tokens are counted locally and billed without a cache discount.
Errors
Errors use the OpenAI error shape, so SDKs raise their usual exceptions.
| Status | Code | What to do |
|---|---|---|
| 401 | invalid_api_key | The key is wrong or revoked. Create a new one in the dashboard. |
| 402 | insufficient_quota | The balance cannot cover this request. Top up, or lower max_tokens. |
| 402 | spend_cap_exceeded | This key reached its spend cap. Raise the cap or use another key. |
| 403 | model_not_allowed | The key’s model list excludes this model. |
| 403 | account_suspended | The account is suspended. Contact support. |
| 404 | model_not_found | No enabled model has this ID. List them with GET /v1/models. |
| 429 | rate_limit_exceeded | Too many requests. Wait for the Retry-After header. |
| 502 | upstream_error | The model provider failed before responding. You were not charged. |
| 503 | model_unavailable | This model is temporarily off. Try another model. |
Limits
Requests are limited per key and per account, and request bodies are limited to 8 MB. Past a rate limit you get a 429 with a Retry-After header. Each key can also carry a spend cap and a model list, set in the dashboard.