Skip to main content
Claude Code talks to api.anthropic.com by default, but it ships with built-in gateway support: point ANTHROPIC_BASE_URL at Opper and the same harness runs on any of 300+ models — Anthropic, OpenAI, Google, Kimi, DeepSeek, and more — with one API key, one bill at provider rates, configurable fallbacks, and per-session cost tracking. Unlike proxy tools such as claude-code-router, there is nothing to run on your machine: no local server, no router config file to maintain. Claude Code speaks its native protocol directly to Opper’s Anthropic-compatible endpoint, and the routing happens server-side in the gateway.

Prerequisites

  • Node.js ≥ 20.12 (npx works without a global install)
  • Claude Code installed
  • An Opper account — free to create; the login step below opens sign-up if you don’t have one

Quick start

launch claude sets ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN for the session and starts Claude Code — no config files, nothing else to run. Install globally with npm i -g @opperai/cli if you prefer opper on your PATH; verify your login anytime with opper whoami.
If you were previously signed in to Claude Code with an Anthropic account, run /logout inside Claude Code once so cached credentials don’t conflict with the gateway, then confirm with /status that the Opper base URL is active.

Switch the model

Pass any model from the catalog with --model, using full model IDs:
Anything after the agent name is forwarded to Claude Code verbatim:

Manual configuration (without the CLI)

Claude Code’s own environment variables work directly against Opper’s Anthropic-compatible endpoint. Get an API key (opper config get default prints the key for your default credential), then:
The ANTHROPIC_DEFAULT_* variables map Claude Code’s model aliases, and any full ID from the catalog works in each slot — so /model sonnet can resolve to a non-Anthropic model entirely:
ANTHROPIC_SMALL_FAST_MODEL is deprecated in Claude Code; use ANTHROPIC_DEFAULT_HAIKU_MODEL for the background model.
To route a single project through Opper while others keep using your Anthropic subscription, put the same keys in that project’s .claude/settings.local.json instead of your shell profile:

Show gateway models in the /model picker

Claude Code can populate its /model picker from the gateway’s model list:
Discovered models appear in the picker labeled “From gateway”; any catalog ID also works directly via --model or the env vars above. Alternatively, pin a single custom entry with ANTHROPIC_CUSTOM_MODEL_OPTION (plus _NAME and _DESCRIPTION).

Claude Agent SDK and CI

The same environment variables route the Claude Agent SDK through Opper. In CI — GitHub Actions, for example — set the base URL in the workflow and keep the key in a secret:

Keep inference in the EU

Opper’s gateway is hosted exclusively in the EU — the only thing that leaves is the model call itself, and you control where that goes. Pick an EU-hosted model from the catalog (marked in the list, e.g. mistral/mistral-large-2512) and your coding sessions never leave the EU. See Keep data in the EU for how routing restrictions are enforced at the gateway. On a network that only allows egress to the gateway, also set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 — it turns off Claude Code’s nonessential background traffic to Anthropic and third-party services (version checks, telemetry, error reports), which would otherwise show up as blocked connections in egress monitoring.

Coming from OpenRouter or claude-code-router?

  • From OpenRouter — same mechanism, different base URL: set ANTHROPIC_BASE_URL=https://api.opper.ai/v3/compat and pass your Opper key as ANTHROPIC_AUTH_TOKEN. You gain EU-hosted routing, inference at provider rates, and per-call tracing.
  • From claude-code-router — the open-source proxy runs locally and needs its own config file and process. With Opper the router runs server-side: the two env vars above are the entire setup, and they work anywhere Claude Code runs, including CI.

What changes compared to Anthropic direct

  • Billing. Routed sessions are billed as API usage through Opper at provider rates. A Claude Pro or Max subscription does not apply while a gateway credential is active.
  • Model IDs. The opus / sonnet / haiku aliases resolve through the ANTHROPIC_DEFAULT_* mapping; for everything else use full IDs from the catalog.
  • Feature parity. Some Anthropic-endpoint conveniences (prompt caching among them) depend on the route serving your request. Anthropic documents the gateway mechanism but does not officially support non-Claude models in Claude Code, so expect polish to vary by model — frontier models and strong open-weight tool-callers work well in practice.
  • Reliability. Opper aliases can define backup chains: if the primary model fails or a provider has an outage, the call falls through to the next model in the chain.

Troubleshooting

  • “Model not found” — use the full model ID exactly as listed in the catalog; aliases only resolve through the ANTHROPIC_DEFAULT_* mapping.
  • Auth errors — run opper whoami; re-run opper login if the session expired. If Claude Code was previously signed in to an Anthropic account, /logout once and check /status shows the Opper base URL.
  • Context length errors — context windows differ per model; check the catalog and pick a model sized for your session.
  • Checking spend — every routed session is metered with per-call cost, latency, and token accounting in your Opper dashboard.