Claude Code CLI
Configure the Claude Code CLI to use TokAPI as its Anthropic-compatible gateway.
TokAPI is fully compatible with the Anthropic Messages API, so Claude Code works against it with no code changes — just point it at TokAPI and supply your key.
Configure ~/.claude/settings.json
Create or edit ~/.claude/settings.json and add an env block:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.tokapi.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-lazytech-...",
"ANTHROPIC_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-8",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"hasCompletedOnboarding": true
}Replace sk-lazytech-... with your actual TokAPI key, then restart Claude Code.
Model IDs
TokAPI uses real Claude model IDs:
| Role | Model ID |
|---|---|
| Flagship | claude-opus-4-8 (Opus 4.8, ~1M context) |
| Balanced | claude-sonnet-4-6 (Sonnet 4.6) |
| Fastest | claude-haiku-4-5 (Haiku 4.5) |
Verify
Run any Claude Code command. Requests are routed through
POST https://api.tokapi.ai/v1/messages. You can confirm connectivity with:
curl https://api.tokapi.ai/v1/pingSee the Models page for the full catalog and the API Reference for endpoint details.