Documentation
Fully OpenAI-compatible. Point your existing code at our base URL and key — nothing else changes.
Quick start
Three steps: get a key, top up with USDT, change the base URL.
curl https://api.tokenonline.ai/v1/chat/completions \
-H "Authorization: Bearer $TOKENONLINE_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v3.2",
"messages": [{"role": "user", "content": "Hello"}]
}'Authentication
All requests use a Bearer token. Create keys on the Keys page — you can have several, one per project. A key is shown only once, so save it immediately.
Authorization: Bearer tk_live_xxxxxxxxxxxx
Chat completions
POST /v1/chat/completions — parameters match OpenAI exactly: model, messages, temperature, top_p, max_tokens, stop, stream.
{
"model": "claude-sonnet-4.5",
"messages": [
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Explain SSE in one sentence."}
],
"temperature": 0.7,
"max_tokens": 512
}Streaming
Set stream: true for standard SSE. Our gateway passes bytes through with zero buffering — time-to-first-token is within milliseconds of upstream, and long responses are never cut off mid-stream.
curl https://api.tokenonline.ai/v1/chat/completions \
-H "Authorization: Bearer $TOKENONLINE_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.2","stream":true,"messages":[{"role":"user","content":"Hi"}]}'
# data: {"choices":[{"delta":{"content":"He"}}]}
# data: {"choices":[{"delta":{"content":"llo"}}]}
# data: [DONE]Models
GET /v1/models returns every model on sale with live pricing. Or browse the library →
curl https://api.tokenonline.ai/v1/models
Video generation
Video is an async job: submit, poll for status, then fetch the file. Billed by actual generated seconds — over-authorized amounts are refunded, and failed jobs cost nothing.
# 1. submit
curl -X POST https://api.tokenonline.ai/v1/videos \
-H "Authorization: Bearer $TOKENONLINE_KEY" \
-d '{"model":"sora-2","prompt":"a jade coin spinning","seconds":4}'
# → {"id":"vid_xxx","status":"queued"}
# 2. poll
curl https://api.tokenonline.ai/v1/videos/vid_xxx \
-H "Authorization: Bearer $TOKENONLINE_KEY"
# → {"id":"vid_xxx","status":"completed","seconds":4}
# 3. download
curl https://api.tokenonline.ai/v1/videos/vid_xxx/content \
-H "Authorization: Bearer $TOKENONLINE_KEY" -o out.mp4Day passes
Besides pay-as-you-go, you can buy a day pass or a monthly plan: unlimited use within the period (subject to a daily fair-use cap), with no per-token charge. Use the same key — entitlements are detected automatically.
Errors
| HTTP | code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Key invalid or disabled |
| 402 | insufficient_quota | Balance too low — top up |
| 404 | model_not_found | Unknown or unavailable model |
| 429 | rate_limited | Too many requests |
| 503 | no_supply | No healthy supply right now — retry shortly |
Rate limits
Limits are per key and generous for normal use. A 503 no_supply means the pool has no healthy supply for that model at this instant — we tell you honestly rather than failing silently. Retries usually succeed within seconds.