Client setup
Recommended: manage it all with cc-switch. If you use several AI tools at once, do not hand-edit each config file — cc-switch is a desktop app where you add AllTokens once and 10 tools share one provider configuration, with tray switching and automatic failover. It is built by a partner of ours and it is the setup we recommend most (install · configure AllTokens).
Two values and you are done
Any OpenAI-compatible client that accepts a custom base URL needs:
| Field | Value |
|---|---|
| Base URL | https://alltokens.si/v1 |
| API key | Your personal key, or a shared key from an administrator |
Model names are whatever the platform currently serves. Different channels and groups expose different models, and the list changes. Check models and pricing and substitute the real name for the placeholders below.
curl
export ALLTOKENS_API_KEY='sk-...'
curl https://alltokens.si/v1/chat/completions \
-H "Authorization: Bearer $ALLTOKENS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "replace with a model the platform actually serves",
"messages": [{"role": "user", "content": "Hello"}],
"stream": false
}'Set stream to true for SSE streaming; the gateway does not add buffering.
OpenAI Python SDK
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["ALLTOKENS_API_KEY"],
base_url="https://alltokens.si/v1",
)
resp = client.chat.completions.create(
model="replace with a model the platform actually serves",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)Or leave the code alone and use environment variables:
export OPENAI_API_KEY='sk-...'
export OPENAI_BASE_URL='https://alltokens.si/v1'OpenAI Node SDK
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: process.env.ALLTOKENS_API_KEY,
baseURL: 'https://alltokens.si/v1'
})
const resp = await client.chat.completions.create({
model: 'replace with a model the platform actually serves',
messages: [{ role: 'user', content: 'Hello' }]
})
console.log(resp.choices[0].message.content)Anthropic-compatible clients
Tools that speak the Anthropic protocol rather than the OpenAI one want the site address without /v1:
https://alltokens.siWhich one a given client needs depends on the protocol it implements. If it asks for an “OpenAI base URL”, use https://alltokens.si/v1; if it asks for an “Anthropic API address”, use https://alltokens.si.
Debugging order
- 401 — key missing, wrong, or disabled. Check for
Authorization: Bearer sk-.... - 402 — insufficient balance (personal for a personal key, enterprise for a shared key).
- 403 — usually the member quota is exhausted, or the requested model group is not allowed for the enterprise.
- 429 — rate limited; the gateway applies a global limit.
- 404 / model not found — the model name is not available; check models and pricing .
Details in the FAQ.
Per-client walkthroughs
To be completed: step-by-step guides per client (terminal CLIs, editor extensions, desktop apps). This release covers the generic protocol and the standard SDKs.
For terminal CLIs you can skip that step entirely: cc-switch writes AllTokens into Claude Code, Codex, Gemini CLI, Grok Build, OpenCode, OpenClaw, Hermes, Pi and more, without hand-editing each config file. Editor extensions and desktop apps still take the Base URL and key their own official way.