Claude Code
Configure the Claude Code CLI through the Anthropic Messages endpoint.
Check third-party compatibility
Claude Code requires Anthropic Messages, streaming and compatible tool responses. Anthropic does not officially support non-Claude models in Claude Code. Third-party model compatibility must be tested with your client version; some features may be unavailable.
Choose a model that is enabled for your key and supports the required protocol. Do not assume every model in the directory works with coding agents.
Edit the user settings file
Back up and merge the env object into ~/.claude/settings.json, or %USERPROFILE%\.claude\settings.json on Windows. Keep existing settings. Replace the key and every YOUR_MODEL_ID value locally.
Use https://easyrouteapi.com without /v1: the client adds /v1/messages. Map Haiku, Sonnet and Opus to tested model IDs so auxiliary requests do not accidentally use an unavailable default model.
settings.json contains a secret when you store ANTHROPIC_AUTH_TOKEN here. Restrict access to the file and never commit or share it. You can supply the token through the local process environment instead.
{
"env": {
"ANTHROPIC_BASE_URL": "https://easyrouteapi.com",
"ANTHROPIC_AUTH_TOKEN": "YOUR_EASYROUTEAPI_KEY",
"ANTHROPIC_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "YOUR_MODEL_ID"
}
}Start a fresh session
Restart Claude Code, run /status and confirm the gateway address, credential source and model. Send a small request and verify it in EasyRouteAPI Usage Logs. Check a simple tool call before enabling an autonomous workflow.
claude --model YOUR_MODEL_ID