Claude Code
Connect Claude Code to Tokener.ai through the Anthropic-compatible /messages endpoint.
Claude Code supports custom gateways through
environment variables. Tokener.ai serves the Anthropic Messages API at
POST /messages, so Claude Code runs against Tokener.ai with your API key
and any chat model from the Models catalog.
Configure
Set the base URL, credential, and model. The base URL is the origin only —
no /v1 suffix; Claude Code appends the path itself:
export ANTHROPIC_BASE_URL=https://api.tokener.dev
export ANTHROPIC_AUTH_TOKEN=sk-... # your Tokener.ai API key
export ANTHROPIC_MODEL=<model-id>ANTHROPIC_AUTH_TOKEN is sent as the Bearer token; ANTHROPIC_API_KEY
(sent as x-api-key) works as well. Create keys in
API keys.
To persist the configuration everywhere Claude Code runs, use the env
block of ~/.claude/settings.json instead of shell exports:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.tokener.dev",
"ANTHROPIC_AUTH_TOKEN": "sk-...",
"ANTHROPIC_MODEL": "<model-id>"
}
}Run /status inside Claude Code to confirm the active base URL and
credential source.
Background model
Claude Code sends background traffic such as session titles and summaries to a small model. Route it to a model available to your key:
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<model-id>Expected notices
- Claude Code assumes a 200k context window for model ids it does not
recognize and warns once. Set
CLAUDE_CODE_MAX_CONTEXT_TOKENSto the model's real context window from the Models catalog. - Optional:
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1lets the/modelpicker list the models available to your key.
Claude Code requests bill against your organization's credits like any other traffic on the model API.