Claude Code
Claude Code connects to indoRouter through the Anthropic-format endpoint, /v1/messages. This endpoint supports every chat model in the catalog, so you can use Claude or another chat model.
Before you start
Section titled “Before you start”Create an API key on the API Key page before you start.
Configuration
Section titled “Configuration”Run this in a terminal, then start claude:
export ANTHROPIC_BASE_URL="https://api.indorouter.ai"export ANTHROPIC_AUTH_TOKEN="ir_..."export ANTHROPIC_MODEL="anthropic/claude-sonnet-5.5"export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-5.5"export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-5.5"export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-sonnet-5.5"export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1claudeANTHROPIC_BASE_URL has no /v1 at the end. Claude Code adds /v1/messages itself.
Claude Code’s subagents ask for the opus, sonnet and haiku aliases by name. The three ANTHROPIC_DEFAULT_* lines point those aliases at models we serve. The console fills them in for you: opus and sonnet go to the newest Claude Opus and Sonnet in the catalog (or to your chosen model if it is one of them), and haiku goes to the model you chose.
Switch models in the middle of a session with /model <id>.
Using other models
Section titled “Using other models”Put the model ID in ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL, and add one more line with the model’s context window:
export ANTHROPIC_MODEL="openai/gpt-4o-mini"export ANTHROPIC_DEFAULT_HAIKU_MODEL="openai/gpt-4o-mini"export CLAUDE_CODE_MAX_CONTEXT_TOKENS=128000Claude Code assumes 200,000 tokens of context for any model it doesn’t know, and compacts the conversation at that size. The extra line tells it the real size. Change it when you switch to a model with a different window. Find each model’s context window at indorouter.ai/models.
Check the connection
Section titled “Check the connection”Start claude and ask it something short. The request appears on the console’s Requests page with the model that answered and what it cost.
Troubleshooting
Section titled “Troubleshooting”- 404 on every request:
ANTHROPIC_BASE_URLprobably ends in/v1. Remove it. model_not_found: the model ID is missing its vendor. Writeanthropic/claude-sonnet-5.5, notclaude-sonnet-5.5.