Run Claude Code on OAIRoute
Claude Code reads ANTHROPIC_BASE_URL and an auth token. Change those two and every request goes through the gateway — same CLI, same tools, same behaviour, a fraction of the bill.
Configuration
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.oairoute.com",
"ANTHROPIC_API_KEY": "YOUR_OAIROUTE_KEY",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
}
}claude in any project directory.Why route it through OAIRoute
Same model, a fifth of the price
Claude Opus 5.5 is $0.20 per million input tokens and $1.00 per million output tokens through the gateway, against $4.00 / $20.00 on Anthropic list.
One key for the whole stack
The same key that runs Claude Code also reaches GPT, Gemini, DeepSeek and 200+ other models, so side-by-side comparisons cost you nothing extra to set up.
No proxy, no wrapper binary
Claude Code talks HTTPS straight to api.oairoute.com. Nothing to install locally, nothing to keep updated.
Setup
- 1
Create a key
Register at api.oairoute.com and create a key on the token page. It starts with sk-.
- 2
Write the config block
Save the JSON below to ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json).
- 3
Verify
Run `claude --version`, then ask it to read a file. If it answers, the gateway is in the loop.
Models worth trying
| Model ID | Name | Use it for | USD per 1M in / out |
|---|---|---|---|
claude-opus-5-5 | Claude Opus 5.5 | Deepest reasoning, 1M context. Default for hard refactors. | $0.20 / $1.00 |
claude-sonnet-5-5 | Claude Sonnet 5.5 | Near-Opus on most coding tasks at a tenth the price gap. | $0.18 / $0.90 |
deepseek-v4.1-flash | DeepSeek V4.1 Flash | Cheap enough for subagents and grep-heavy steps. | $0.045 / $0.18 |
Prices are per million tokens, input / output, at the rates published in the model catalogue.
Questions
Does Claude Code work unchanged?
Yes. It still speaks the Anthropic Messages API; only the base URL and key change. Tool use, subagents, MCP servers and slash commands all keep working.
Why do I get a 404?
ANTHROPIC_BASE_URL most likely has a trailing /v1. The correct value is https://api.oairoute.com with no path.
Can I mix Anthropic and non-Anthropic models in one session?
You can switch models with `claude --model`, but Claude Code is tuned for the Claude family. Non-Claude models work for chat-style turns; agent behaviour degrades.