Agents & CLIsReference / 17

Claude Code with RouterPlex

Route Claude Code to any RouterPlex chat model — no translation proxy needed. One base URL change adds a prepaid balance with per-key budgets.

Follow updates Share setup

Claude Code speaks Anthropic's Messages API, and RouterPlex exposes that format for every chat model — so you can point Claude Code straight at Claude, GPT, Gemini, DeepSeek, and the rest of the chat catalog. No bridge or router required.

Works on macOS, Linux, and Windows.

1. Install Claude Code #

bash
npm install -g @anthropic-ai/claude-code

2. Point it at RouterPlex #

Create or edit Claude Code's settings file and set the base URL and your RouterPlex key under env:

  • macOS / Linux: ~/.claude/settings.json
  • Windows: %USERPROFILE%\.claude\settings.json
json
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.routerplex.com",
"ANTHROPIC_AUTH_TOKEN": "sk-...",
"ANTHROPIC_MODEL": "claude-opus-4-8",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5"
}
}
  • ANTHROPIC_AUTH_TOKEN — your RouterPlex API key (create one under API keys & budgets).
  • ANTHROPIC_MODEL — the model for normal turns. Use any chat ID from the catalog, e.g. claude-opus-4-8, gpt-5.4, or gemini-3.5-flash.
  • ANTHROPIC_SMALL_FAST_MODEL — the cheaper model Claude Code uses for background chores, e.g. claude-haiku-4-5 or deepseek-v4-flash.

Prefer to set it per shell session instead? macOS/Linux:

bash
export ANTHROPIC_BASE_URL=https://api.routerplex.com
export ANTHROPIC_AUTH_TOKEN=sk-...
export ANTHROPIC_MODEL=claude-opus-4-8
claude

Windows (PowerShell):

powershell
$env:ANTHROPIC_BASE_URL = "https://api.routerplex.com"
$env:ANTHROPIC_AUTH_TOKEN = "sk-..."
$env:ANTHROPIC_MODEL = "claude-opus-4-8"
claude

3. Verify #

Start claude, then run /status — it should show the RouterPlex base URL and your model. Switch models any time with /model gpt-5.4 or another chat model ID.

Every chat model accepts the Messages format, but capabilities still vary. Claude-family models are the safest default for Claude Code's full tool-use behavior. Give this key its own budget; coding agents burn tokens fast.

Do you need Claude Code Router? #

Usually not. Claude Code Router (CCR) is a separate community proxy that runs a local gateway in front of Claude Code. RouterPlex already translates Anthropic Messages for every chat model, including non-Claude ones, so the base URL above is all you need to change model families — no local proxy involved.

Reach for CCR when you actually want its local routing policy: several upstream providers at once, conditional routes, or local fallbacks. RouterPlex works as an OpenAI-compatible provider inside it, using base URL https://api.routerplex.com/v1 and a RouterPlex key.

Current CCR releases configure providers through their management UI and store live settings in SQLite — a config.json is only read once as a migration source, so the older config-file walkthroughs no longer apply. The current setup is covered in Claude Code Router: route Claude Code to any model.

Claude Code with RouterPlex — Docs