Reduce AI API costs by routing simple tasks to cheaper models while using powerful models only for complex reasoning.
Use AI providers and models not natively supported by Claude Code, such as local Ollama models or DeepSeek.
Experiment with different AI backends and compare their performance without changing your coding workflow or switching tools.
Switch between models on the fly during a coding session using slash commands without restarting Claude Code.
Requires configuring routing rules and API keys for target AI providers before the proxy can function.
Claude Code Router is a proxy tool that sits between the Claude Code AI coding assistant (Anthropic's official CLI agent) and the AI model it calls. Rather than always sending requests to Anthropic's Claude models, this tool intercepts those requests and can route them to different AI providers and models based on rules you define, such as using a cheaper model for simple background tasks and a more powerful model for complex reasoning. The tool works by running a local server that Claude Code connects to instead of Anthropic's API directly. You configure routing rules in a JSON file specifying which model to use for different types of requests. It supports multiple providers including OpenRouter, DeepSeek, Ollama (for local models), Gemini, and others. Transformers, small plugins, handle differences in API format between providers, so Claude Code's request format gets translated to whatever each provider expects. Practically, this means a developer can use Claude Code's interface and workflow, which they are familiar with and which receives ongoing updates from Anthropic, while routing the underlying AI calls to different, potentially cheaper or faster models. A slash command within Claude Code also lets you switch models on the fly during a session. Someone would use this when they want to reduce AI API costs by mixing models strategically, when they want to use models from providers not natively supported by Claude Code, or when they want to experiment with different AI backends without changing their coding workflow. The tech stack is TypeScript/Node.js, installed as a global npm package. It requires Claude Code to already be installed.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.