Integrations
Claude Code
Claude Code is Anthropic's official terminal coding agent. Point it at ezrouter's Anthropic-compat surface and it will route through any claude model in the catalog.
For a graphical alternative that lets you switch between providers without editing environment variables, see CC Switch.
Migrate an existing install
If claude is already installed, set four environment variables and restart your shell. Get a key from the ezrouter dashboard.
Linux / macOS:
export ANTHROPIC_BASE_URL=https://www.ezrouter.dev/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-your-ezrouter-key
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5Windows PowerShell:
$env:ANTHROPIC_BASE_URL = "https://www.ezrouter.dev/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-ezrouter-key"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "claude-sonnet-4-6"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5"Then run claude from your project directory:
cd /path/to/project
claudeInstall from scratch
Install Node.js 18 or newer (Windows also needs Git for Windows), then install Claude Code globally:
npm install -g @anthropic-ai/claude-code
claude --versionApply the environment variables above, then run claude in your project.
Variable reference
| Variable | Required | Purpose |
|---|---|---|
ANTHROPIC_BASE_URL | yes | ezrouter Anthropic surface root. Do not append /v1; Claude Code adds it. |
ANTHROPIC_AUTH_TOKEN | yes | Your ezrouter API key. Sent as a Bearer token; ezrouter accepts both Authorization: Bearer and x-api-key on this surface. |
ANTHROPIC_DEFAULT_SONNET_MODEL | recommended | Model used when Claude Code asks for the sonnet tier. |
ANTHROPIC_DEFAULT_HAIKU_MODEL | recommended | Model used for cheap helper calls (file scans, summaries). |
ANTHROPIC_DEFAULT_OPUS_MODEL | optional | Model used when Claude Code asks for the opus tier. Defaults to the sonnet model if unset. |
ANTHROPIC_MODEL | optional | Override every tier with a single model. Useful for non-claude routes (e.g. deepseek-v4-pro). |
CLAUDE_CODE_SUBAGENT_MODEL | optional | Model the agent uses to spawn sub-agents. |
The model IDs above match ezrouter's catalog — see GET /v1/models for the current list.
Non-claude routes
ezrouter's Anthropic surface translates between the Anthropic wire format and other upstream providers, so you can point Claude Code at non-claude models too:
export ANTHROPIC_MODEL=deepseek-v4-proTroubleshooting
401 invalid_api_key— the token inANTHROPIC_AUTH_TOKENis
wrong, expired, or pasted with trailing whitespace.
403 access_denied— the model inANTHROPIC_DEFAULT_*is not
in your key's allowlist. Query GET /v1/models to see what your key can use.
404 Not Found—ANTHROPIC_BASE_URLlikely has a trailing
/v1. Drop it; Claude Code appends the path itself.
- Hangs on long-running calls — ezrouter does not return 429 under
load, it queues silently (see error codes). Latency growth, not an error, is the throttle signal.
Next steps
- Anthropic API guide — how the
surface works at the protocol level.
- CC Switch — desktop GUI for managing multiple
providers across Claude Code, Codex, and other agents.
- Pricing — per-model rates.