Claude Code
Claude Code talks to the Anthropic Messages API, which TOKEN serves at
https://api.thetoken.dev/v1/messages. Point it at TOKEN with environment
variables.
Settings
Section titled “Settings”export ANTHROPIC_BASE_URL="https://api.thetoken.dev"export ANTHROPIC_AUTH_TOKEN="$TOKEN_API_KEY"export ANTHROPIC_MODEL="moonshotai/kimi-k3"export ANTHROPIC_DEFAULT_HAIKU_MODEL="zai-org/glm-5.3-flash"claude| Variable | Value |
|---|---|
ANTHROPIC_BASE_URL |
https://api.thetoken.dev, without /v1 (Claude Code adds /v1/messages) |
ANTHROPIC_AUTH_TOKEN |
your TOKEN key; sent as Authorization: Bearer |
ANTHROPIC_MODEL |
the main model |
ANTHROPIC_DEFAULT_HAIKU_MODEL |
the model for small background tasks; a fast, cheap model is enough |
If ANTHROPIC_API_KEY is also set in your shell, unset it so Claude Code uses
the TOKEN key.
To keep the settings per project instead of per shell, put them in the env
block of Claude Code’s settings.json (for example .claude/settings.json
in the project):
{ "env": { "ANTHROPIC_BASE_URL": "https://api.thetoken.dev", "ANTHROPIC_MODEL": "zai-org/glm-5.3", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "zai-org/glm-5.3-flash" }}and keep ANTHROPIC_AUTH_TOKEN in your shell, so the key stays out of the
repository.
Choosing models
Section titled “Choosing models”Claude Code calls tools on almost every step, so use models with tool
calling: moonshotai/kimi-k3, zai-org/glm-5.3 or
deepseek/deepseek-v4-pro for the main model. meta-llama/llama-4-maverick
has no tool calling and answers Claude Code’s requests with a 400. Check
the models page for each model’s capabilities and price.
Good to know
Section titled “Good to know”- Cost: Claude Code sends long prompts (your files and the conversation) on every step. Watch the console’s Usage Logs for the first sessions, and give the key a spending limit (console → API Keys).
- Reservation: before each request runs, TOKEN reserves the cost of its maximum output and refunds what is not used. On a small balance, the maximum output is lowered to what the balance can pay. See Errors and rate limits.
- Limits: an account can have 10 requests in flight and 60 requests a
minute. Many parallel sub-agents can reach the first limit; Claude Code
then sees a
429and retries. - Features that depend on Anthropic’s own server-side tools (for example web search) or on Claude-specific behaviour may not work with other models.