// the find
musistudio/claude-code-router
Use Claude Code as the foundation for coding infrastructure, allowing you to decide how to interact with the model while enjoying updates from Anthropic.
A proxy server that intercepts Claude Code's API calls and reroutes them to alternative model providers — DeepSeek, Gemini, Ollama, OpenRouter, and others. The core idea: use cheap or local models for background tasks, route long-context windows to Gemini, keep expensive Anthropic calls only where they matter. Aimed at developers trying to cut Claude API costs without leaving the Claude Code UX.
The routing categories (default/background/think/longContext) map to how Claude Code actually behaves — background tasks legitimately don't need frontier model quality, and routing those to a local Ollama instance can halve your bill without you noticing. The transformer system is well-layered: global provider transforms, per-model overrides, and composable options like maxtoken — you can get precise without forking. Environment variable interpolation in config.json is the right call; no hardcoded keys in dotfiles. The activate command that exports ANTHROPIC_BASE_URL for the shell is a clean integration point — Agent SDK apps pick it up automatically.
This is a man-in-the-middle proxy against a closed CLI whose internals Anthropic hasn't documented; the routing signals for 'background' vs 'think' are reverse-engineered, and any Claude Code update can silently break them. The enhancetool transformer buffers the entire tool-call response before forwarding it, killing streaming for those models — easy to miss in config and hard to diagnose when your UI stops feeling live. No test suite visible anywhere in the repo for a tool that handles API keys, auth tokens, and proxied credentials. The project is sponsored by Z.ai/GLM and the README leads with a paid subscription pitch before explaining what the tool does — worth knowing whose interests are baked in.