Skip to content

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.

Create an API key on the API Key page before you start.

Run this in a terminal, then start claude:

Terminal window
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=1
claude

ANTHROPIC_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>.

Put the model ID in ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL, and add one more line with the model’s context window:

Terminal window
export ANTHROPIC_MODEL="openai/gpt-4o-mini"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="openai/gpt-4o-mini"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=128000

Claude 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.

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.

  • 404 on every request: ANTHROPIC_BASE_URL probably ends in /v1. Remove it.
  • model_not_found: the model ID is missing its vendor. Write anthropic/claude-sonnet-5.5, not claude-sonnet-5.5.