Documentation
Token Master is a drop-in base URL. Point any OpenAI, Anthropic or Gemini client at it and use your Token Master key.
Quickstart
- Create an account. Your dashboard is ready as soon as you sign up.
- Add credit in Wallet. Buy a package, or redeem a code you were given.
- Open API keys, click Create, and copy the
sk-…key. - Set your tool's base URL to
. Add/v1for OpenAI-format clients.
Model IDs
Use model IDs exactly as they appear in the catalogue, for example claude-sonnet-4-6, claude-opus-4-8-thinking, gpt-5.6-terra or kimi-k3. If an ID ends in -thinking, that model uses extended reasoning. These usually cost more output tokens, but they handle multi-step work better.
Keys and limits
- Spending cap. The key stops when it reaches its cap, even if your wallet has more credit.
- Expiry. Useful for demos, contractors and CI.
- Model allow-list. Limit a key to the models you choose, for example cheap models only.
- IP allow-list. Restrict a production key to your servers.
Use one key per project. Your logs stay readable, and if a key leaks only that project is affected.
Claude Code
export ANTHROPIC_BASE_URL= export ANTHROPIC_AUTH_TOKEN=sk-your-key export ANTHROPIC_MODEL=claude-sonnet-4-6 export ANTHROPIC_SMALL_FAST_MODEL=claude-haiku-4-5 claude
To make this permanent, add the same variables under "env" in ~/.claude/settings.json. Do not add /v1 to an Anthropic base URL.
Cursor
In Settings → Models, paste your key under OpenAI API Key. Then turn on Override OpenAI Base URL and set it to . Finally, add model IDs such as claude-sonnet-4-6 or gpt-5.6-terra under Add model.
Cline / Roo Code
Pick the OpenAI Compatible provider. Set the base URL to , add your key, and type the model ID. For Claude models you can also use the Anthropic provider with a custom base URL of .
Codex CLI
# ~/.codex/config.toml model = "gpt-5.6-sol" model_provider = "tokenmaster" [model_providers.tokenmaster] name = "Token Master" base_url = "/v1" env_key = "TOKENMASTER_API_KEY"
Run export TOKENMASTER_API_KEY=sk-your-key, then start codex.
Gemini (CLI and SDK)
export GOOGLE_GEMINI_BASE_URL= export GEMINI_API_KEY=sk-your-key gemini
With @google/genai, pass httpOptions: { baseUrl: "" }. Gemini models only show up here once they're listed in the catalogue.
OpenAI SDK (Python / Node)
from openai import OpenAI
client = OpenAI(base_url="/v1", api_key="sk-your-key")
stream = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Write a haiku about latency"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Anything built on the OpenAI SDK works the same way, including n8n, LangChain, LlamaIndex, OpenClaw and Hermes Agent.
Anthropic SDK
import anthropic
client = anthropic.Anthropic(base_url="", api_key="sk-your-key")
msg = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)Balance and usage
curl /api/usage/token/ -H "Authorization: Bearer sk-your-key"
The response contains total_available and total_used in quota units, where 500,000 units equal $1. The balance checker does the conversion for you. For per-request detail (model, tokens, cost, latency), open Usage logs.
Errors
401: the key is wrong, disabled or expired. Copy it again from the dashboard.403/ insufficient quota: the key or the wallet is out of credit. Top up, or raise the key's cap.404: the base URL is wrong. OpenAI clients need/v1; Anthropic clients must not have it.503 model_not_found/ no available channel: the model ID is misspelled or isn't offered. Check the catalogue.429: you're over your RPM allowance or the upstream is busy. Retry with backoff. The gateway has already tried the other channels before returning this.5xx: a temporary upstream fault. Failed requests are not billed.
Support
Signed-in users can find the support channels in the dashboard. For a large-volume package or a dedicated channel pool, contact us through the dashboard and include your expected monthly token volume.