Claude Code
Point Claude Code at RouteMux with two environment variables — no config file, no plugin.
Claude Code reads its endpoint from environment variables, so switching it to RouteMux takes two values and no code changes.
Configure
export ANTHROPIC_BASE_URL="https://api.routemux.com"
export ANTHROPIC_AUTH_TOKEN="sk-..." # your RouteMux keyOr, if you keep settings in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.routemux.com",
"ANTHROPIC_AUTH_TOKEN": "sk-..."
}
}Do not append /v1
ANTHROPIC_BASE_URL must be the bare origin. The Anthropic client appends /v1/messages
itself, so a base URL ending in /v1 produces /v1/v1/messages.
RouteMux normalises that double prefix rather than failing, but other tools in your stack may not — set it correctly and you avoid the whole class of problem.
Pick a model
Use any model slug from GET /v1/models. Claude Code expects Anthropic-style ids:
export ANTHROPIC_MODEL="anthropic/claude-sonnet-5"Verify
curl https://api.routemux.com/v1/messages \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"anthropic/claude-sonnet-5","max_tokens":32,
"messages":[{"role":"user","content":"ping"}]}'A 402 means the wallet is empty — top up, then retry. Failed requests are never billed.
Troubleshooting
| Symptom | Cause |
|---|---|
401 on every request | Key missing or malformed. RouteMux keys start with sk-. |
400 AMBIGUOUS_API_KEY | Two different keys sent — one in Authorization, another in x-api-key. Clear whichever you are not using. |
404 on /v1/v1/... | Base URL ends in /v1. Remove it. |
| Model "not found" | It is not enabled for your key. GET /v1/models is the source of truth. |