Skip to content

Claude Code ​

Claude Code is Anthropic's command-line coding assistant. Point it at CodingRouter with environment variables or a config file.

Preparation ​

  1. Install or upgrade Claude Code to the latest version: npm install -g @anthropic-ai/claude-code
  2. In the console, create a token in the claude group.

Option 1: environment variables ​

bash
export ANTHROPIC_BASE_URL="https://api.codingrouter.ai"
export ANTHROPIC_AUTH_TOKEN="sk-your-token"
claude
powershell
$env:ANTHROPIC_BASE_URL = "https://api.codingrouter.ai"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-token"
claude

To make this permanent, add the two export lines to ~/.zshrc or ~/.bashrc.

Option 2: settings.json ​

Edit ~/.claude/settings.json (on Windows %USERPROFILE%\.claude\settings.json) so you do not have to set environment variables each time:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.codingrouter.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-token"
  }
}

To use it in one project only, put the same content in the project's .claude/settings.local.json.

Choosing a model ​

After starting, type /model to switch, or set the default model with an environment variable:

bash
export ANTHROPIC_MODEL="claude-opus-5-5"

You can also specify it at startup: claude --model claude-sonnet-5-5.

Verify ​

bash
claude -p "Reply with exactly: CODINGROUTER OK"

If the output is CODINGROUTER OK, the setup works, and this call appears in the console usage log.

Troubleshooting ​

SymptomWhat to do
It asks you to log in to an Anthropic account after startingMake sure the environment variables are set in the same terminal that starts claude; if you logged in to an official account before, run /logout first
ANTHROPIC_API_KEY is also setRemove it and keep only ANTHROPIC_AUTH_TOKEN, so the wrong key is not used
Warning that the model “isn't described by this version's model catalog”Your Claude Code version is old and does not recognize the new model name; it works normally, and the warning goes away after upgrading to the latest version
Returns 404 or HTMLDo not add /v1 at the end of the Base URL
Returns 403 or 503The token's group is not claude, the model name is wrong, or the balance is insufficient