{"slug": "claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one", "title": "Claude Code with any model: three ways to route it (incl. the 2-minute one)", "summary": "Claude Code, the agentic coding interface, can be routed to alternative models such as Kimi K3, GPT-5.4, and Gemini 3.7 Flash using environment variables or the Opper CLI. Opper, an EU-hosted gateway, provides a unified API key for over 700 models and supports EU-hosted routes, addressing data residency requirements for European clients.", "body_md": "Claude Code is the best agentic coding interface right now, but out of the box it only talks to Anthropic's API with Anthropic billing. Sometimes you want the same interface with a different brain: Kimi K3 for cheap long sessions, GPT-5.4 to cross-check a plan, Gemini 3.7 Flash for speed, or simply a model that runs on EU infrastructure because your client requires it.\n\nThere are three ways to do this. I'll go from most configurable to least effort.\n\n[claude-code-router](https://github.com/musistudio/claude-code-router) is the community answer, and it's genuinely powerful: per-task routing rules, request transformers, plugins. If you want \"background tasks go to a cheap model, planning goes to a big one,\" this is your tool.\n\nThe tradeoff is that you run and maintain a local proxy with a JSON config, and you still need API keys for every provider you route to. For a team setup that's real overhead.\n\nClaude Code respects two environment variables, which means any gateway that speaks the Anthropic Messages API can sit behind it. I work at [Opper](https://opper.ai), an EU-hosted gateway that serves 700+ models through one API key, so that's what I'll use:\n\n```\nexport ANTHROPIC_BASE_URL=\"https://api.opper.ai/v3/compat\"\nexport ANTHROPIC_AUTH_TOKEN=\"<your-opper-api-key>\"\nclaude\n```\n\nThat's the whole setup. Because the gateway also implements Anthropic's model-listing endpoint, the `/model`\n\npicker inside Claude Code shows the live catalogue, so you can switch to `moonshot/kimi-k3`\n\n, `openai/gpt-5.4`\n\nor `gemini/gemini-3.5-flash`\n\nmid-session instead of editing config files.\n\nTwo things I like about this over a local proxy: there's nothing running on your machine, and billing is unified, one balance across every model with token prices matching what the providers charge.\n\nIf you don't want to manage env vars at all, the Opper CLI wires everything for you:\n\n```\nnpm install -g @opperai/cli\nopper launch claude\n```\n\n`opper launch`\n\nstarts Claude Code with its inference already routed through the gateway. Pick a model at launch if you want:\n\n```\nopper launch claude --model moonshot/kimi-k3\n```\n\nAnything after the agent name is forwarded to Claude Code verbatim, so `opper launch claude --resume`\n\nworks exactly as you'd expect.\n\nIf you build for European customers, this setup solves a second problem for free. Opper runs in the EU, and the catalogue marks which routes are EU-hosted, including EU variants of frontier models (for example `vertexai/gemini-3.7-flash-eu`\n\n, or Claude served from European Vertex regions). Same Claude Code workflow, but the tokens don't leave Europe, which is the difference between \"we should check with legal\" and \"approved\" in a lot of B2B contexts.\n\n`opper launch claude`\n\nThe full model catalogue with prices and EU/US hosting per route is at [opper.ai/models](https://opper.ai/models). If you try this and something breaks, tell me in the comments, I maintain this setup daily.", "url": "https://wpnews.pro/news/claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one", "canonical_source": "https://dev.to/opper/claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one-2md2", "published_at": "2026-08-20 16:29:41+00:00", "updated_at": "2026-08-20 16:44:50.822800+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-infrastructure", "large-language-models"], "entities": ["Claude Code", "Anthropic", "Opper", "Kimi K3", "GPT-5.4", "Gemini 3.7 Flash", "claude-code-router", "Opper CLI"], "alternates": {"html": "https://wpnews.pro/news/claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one", "markdown": "https://wpnews.pro/news/claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one.md", "text": "https://wpnews.pro/news/claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one.txt", "jsonld": "https://wpnews.pro/news/claude-code-with-any-model-three-ways-to-route-it-incl-the-2-minute-one.jsonld"}}