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

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

Verify the binary is on your path:

bash
claude --version

Configure

Export two variables. On macOS or Linux add them to ~/.zshrc or ~/.bashrc:

bash
export ANTHROPIC_BASE_URL="https://llm.nimbusapi.net"
export ANTHROPIC_AUTH_TOKEN="sk-nim-..."

On Windows (PowerShell), persist them at User scope:

powershell
[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:

bash
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:

bash
claude

On 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 /v1 to the base URL. Claude Code appends it — the base must be https://llm.nimbusapi.net with nothing after the hostname.
  • Model not found: ANTHROPIC_MODEL is set to a bare ID like claude-opus-4.7. Nimbus requires the provider prefix — use anthropic/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 open claude process, restart the terminal, and re-run env | grep ANTHROPIC before launching again.