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:

bash
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-5

Windows PowerShell:

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:

bash
cd /path/to/project
claude

Install from scratch

Install Node.js 18 or newer (Windows also needs Git for Windows), then install Claude Code globally:

bash
npm install -g @anthropic-ai/claude-code
claude --version

Apply the environment variables above, then run claude in your project.

Variable reference

VariableRequiredPurpose
ANTHROPIC_BASE_URLyesezrouter Anthropic surface root. Do not append /v1; Claude Code adds it.
ANTHROPIC_AUTH_TOKENyesYour ezrouter API key. Sent as a Bearer token; ezrouter accepts both Authorization: Bearer and x-api-key on this surface.
ANTHROPIC_DEFAULT_SONNET_MODELrecommendedModel used when Claude Code asks for the sonnet tier.
ANTHROPIC_DEFAULT_HAIKU_MODELrecommendedModel used for cheap helper calls (file scans, summaries).
ANTHROPIC_DEFAULT_OPUS_MODELoptionalModel used when Claude Code asks for the opus tier. Defaults to the sonnet model if unset.
ANTHROPIC_MODELoptionalOverride every tier with a single model. Useful for non-claude routes (e.g. deepseek-v4-pro).
CLAUDE_CODE_SUBAGENT_MODELoptionalModel 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:

bash
export ANTHROPIC_MODEL=deepseek-v4-pro

Troubleshooting

  • 401 invalid_api_key — the token in ANTHROPIC_AUTH_TOKEN is

wrong, expired, or pasted with trailing whitespace.

  • 403 access_denied — the model in ANTHROPIC_DEFAULT_* is not

in your key's allowlist. Query GET /v1/models to see what your key can use.

  • 404 Not FoundANTHROPIC_BASE_URL likely 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

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.