Claude Code
Route Anthropic's official CLI through Nimbus. Two env vars, no config file, works with every model on the router — including OpenAI, Gemini, and open-source weights that Claude Code was never designed to reach.
Claude Code reads two environment variables at startup: ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. Set them to Nimbus and the CLI hits llm.nimbusapi.net/v1/messages instead of the Anthropic default.
Prerequisites
- Claude Code installed (
npm i -g @anthropic-ai/claude-code). - A Nimbus API key (
sk-nim-...). - Node.js 18+ on your $PATH.
Install
npm i -g @anthropic-ai/claude-codeVerify the binary is on your path:
claude --versionConfigure
Export two variables. On macOS or Linux add them to ~/.zshrc or ~/.bashrc:
export ANTHROPIC_BASE_URL="https://llm.nimbusapi.net"
export ANTHROPIC_AUTH_TOKEN="sk-nim-..."On Windows (PowerShell), persist them at User scope:
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://llm.nimbusapi.net", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-nim-...", "User")Optionally pin a specific model so every session uses it — otherwise the CLI picks its default:
export ANTHROPIC_MODEL="anthropic/claude-opus-4.7"
# or route to a non-Anthropic model:
# export ANTHROPIC_MODEL="openai/gpt-5.1"First call
Open a terminal in any project folder and run:
claudeOn first launch the CLI prints a welcome banner and asks you to pick a theme, then drops you at the prompt. Because ANTHROPIC_AUTH_TOKEN is already set, it skips the Anthropic OAuth flow entirely — no browser tab opens, no login screen. The first prompt you type triggers a request against llm.nimbusapi.net/v1/messages; watch the Nimbus dashboard for the row appearing under Requests within a second.
Confirm the routing with the built-in /model slash command — it prints the model ID currently in use.
Troubleshooting
- CLI keeps asking to log in: the shell never picked up the env var. Print
echo $ANTHROPIC_AUTH_TOKEN(bash/zsh) or$env:ANTHROPIC_AUTH_TOKEN(PowerShell). If empty, restart the terminal after editing your rc file. - 401 Unauthorized: the key isn't a Nimbus key (must start
sk-nim-), or it's pointing at an Anthropic key by mistake. Nimbus does not accept Anthropic keys. - 404 on /v1/messages: you added
/v1to the base URL. Claude Code appends it — the base must behttps://llm.nimbusapi.netwith nothing after the hostname. - Model not found:
ANTHROPIC_MODELis set to a bare ID likeclaude-opus-4.7. Nimbus requires the provider prefix — useanthropic/claude-opus-4.7. Full list at Models. - Nimbus dashboard shows no traffic: the CLI is still hitting
api.anthropic.com. Some shells cache exported vars per session — kill every openclaudeprocess, restart the terminal, and re-runenv | grep ANTHROPICbefore launching again.