AI Perks curates and provides access to exclusive discounts, credits, and deals on AI tools, cloud services, and APIs to help startups and developers save money.

What Is Claude Code Router?
Claude Code Router is an open-source proxy gateway that sits between Claude Code and any LLM provider. It binds to a local port (usually 127.0.0.1:3456) and lets you route different types of Claude Code requests to different models - Claude for some tasks, DeepSeek or Gemini for others, local Ollama for cheap operations.
The result: lower API costs, no single-vendor lock-in, and intelligent routing per task type. And when you pair Claude Code Router with free Anthropic and OpenAI credits worth $1,500-$75,000+ from AI Perks, you get the best of every provider at zero cost.
Save your budget on AI Credits
| Software | Approx Credits | Approval Index | Actions | |
|---|---|---|---|---|
Promote your SaaS
Reach 90,000+ founders globally looking for tools like yours
Why Use Claude Code Router
Claude Code by default sends every request to Anthropic's Claude API. That's fine if you have unlimited Claude budget - but in 2026, three reasons make a multi-model router compelling:
| Reason | Without Router | With Router |
|---|---|---|
| Cost optimization | All tasks at Sonnet 4.6 ($3/$15) | Cheap tasks → DeepSeek ($0.14/$0.28) |
| Rate limit avoidance | Hit Anthropic limits → blocked | Auto-failover to other providers |
| Provider-specific strengths | Claude only | Use Gemini for vision, GPT for code, etc. |
| Privacy/local execution | Cloud only | Route sensitive tasks to local Ollama |
For developers running heavy Claude Code workloads, Claude Code Router can cut API costs by 50-99% depending on routing strategy.
AI Perks curates and provides access to exclusive discounts, credits, and deals on AI tools, cloud services, and APIs to help startups and developers save money.

Supported Providers in Claude Code Router
| Provider | Strengths | Pricing Tier |
|---|---|---|
| Anthropic (default) | Best coding quality | Premium |
| OpenRouter | 200+ models, one API | Variable |
| DeepSeek | Cheap reasoning (R1, V3) | Ultra-cheap |
| Gemini | Long context, vision | Free tier + cheap paid |
| Ollama | Local, private, free | $0 (your hardware) |
| OpenAI (GPT-5, GPT-4.1) | Strong general capability | Premium |
| VolcEngine / SiliconFlow | Fast Chinese providers | Cheap |
| DashScope (Alibaba Qwen) | Strong open models | Cheap |
| ModelScope | Open-source model hosting | Variable |
Multi-provider routing is the killer feature. A single Claude Code session can use 3-5 different providers transparently based on routing rules.
How to Install Claude Code Router
Prerequisites
- Claude Code installed (
npm install -g @anthropic-ai/claude-code@latest) - Node.js 18 or later
- API keys for at least one non-Anthropic provider (or Ollama running locally)
Install via npm
npm install -g @musistudio/claude-code-router
Or via GitHub
git clone https://github.com/musistudio/claude-code-router
cd claude-code-router
npm install
npm run build
Configuring Claude Code Router
The router uses a JSON config file at ~/.claude-code-router/config.json:
{
"Providers": [
{
"name": "anthropic",
"api_key": "sk-ant-...",
"api_base": "https://api.anthropic.com"
},
{
"name": "deepseek",
"api_key": "sk-deepseek-...",
"api_base": "https://api.deepseek.com"
},
{
"name": "openrouter",
"api_key": "sk-or-...",
"api_base": "https://openrouter.ai/api/v1"
}
],
"Router": {
"default": "anthropic,claude-sonnet-4-6",
"background": "deepseek,deepseek-chat",
"reasoning": "deepseek,deepseek-r1",
"longContext": "gemini,gemini-2.5-pro"
}
}
What Each Routing Category Does
| Category | When Used | Recommended Model |
|---|---|---|
default | Standard prompts | Claude Sonnet 4.6 (quality) |
background | Auto-tasks, summaries | DeepSeek Chat (cheap) |
reasoning | Complex problem-solving | DeepSeek R1 or Claude Opus |
longContext | Large codebases | Gemini 2.5 Pro (1M context) |
You can add custom routing rules based on token count, task type, or any logic you write in JavaScript.
Starting Claude Code Router
Run the router service:
ccr start
Then configure Claude Code to use the router:
export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
claude
Now every Claude Code request flows through the router and gets routed to the appropriate provider per your config.
Cost Savings With Claude Code Router
A real-world routing strategy might split traffic this way:
| Task Type | % of Traffic | Provider | Cost Per 1M Tokens |
|---|---|---|---|
| Default coding | 40% | Claude Sonnet 4.6 | $3 / $15 |
| Background tasks | 30% | DeepSeek Chat | $0.14 / $0.28 |
| Long-context reads | 20% | Gemini 2.5 Pro | $1.25 / $5 |
| Local privacy | 10% | Ollama (local) | $0 |
Monthly Cost Comparison (Heavy User, 100M Tokens/Month)
| Setup | Monthly Cost | vs Anthropic-Only |
|---|---|---|
| All Claude Sonnet 4.6 | $1,500 - $1,800 | Baseline |
| Smart Routing (above) | $300 - $500 | 70-80% savings |
| Router + Free Credits | $0 - $50 | 97-100% savings |
Combined with free credits via AI Perks, the router can drop your real costs to near zero.
Routing Rules Examples
Route by Token Count
"Router": {
"default": "anthropic,claude-sonnet-4-6",
"longContext": "gemini,gemini-2.5-pro",
"tokenThreshold": 50000
}
When a request exceeds 50,000 input tokens, it routes to Gemini's million-token context window instead of Claude.
Route by Task Type
"Router": {
"default": "anthropic,claude-sonnet-4-6",
"background": "deepseek,deepseek-chat",
"vision": "gemini,gemini-2.5-pro"
}
Background tasks go to cheap DeepSeek, vision tasks go to Gemini, normal tasks stay on Claude.
Route Sensitive Code to Local Ollama
"Router": {
"default": "anthropic,claude-sonnet-4-6",
"private": "ollama,llama-3.3-70b"
}
Mark sensitive prompts with metadata to route them to local Ollama, avoiding any cloud transmission.
Why Claude Code Router + Free Credits Is the Ultimate Setup
The router by itself reduces costs. Combine it with free credits and the cost drops to zero while preserving Claude quality where it matters.
Free Credit Programs That Power the Router
| Credit Source | Available Credits | Used For |
|---|---|---|
| Anthropic Claude (Direct) | $1,000 - $25,000 | Default + reasoning routes |
| OpenAI (GPT-5, GPT-4.1) | $500 - $50,000 | Alternative coding routes |
| Google Cloud Vertex (Gemini) | $1,000 - $25,000 | Long-context routes |
| AWS Activate (Bedrock - Claude) | $1,000 - $100,000 | Backup Claude access |
| Microsoft Founders Hub | $500 - $1,000 | Azure OpenAI access |
Total potential: $4,000 - $201,000+ in free credits across all providers
AI Perks covers every program, so your Claude Code Router can pull from multiple free credit sources.
Step-by-Step: Set Up Router + Free Credits
Step 1: Get Free Credits Across Providers
Subscribe to AI Perks and apply for the highest-value Anthropic, OpenAI, and Google Cloud credit programs.
Step 2: Install Claude Code Router
npm install -g @musistudio/claude-code-router
Step 3: Configure Multi-Provider Routing
Edit ~/.claude-code-router/config.json with API keys from each provider (all powered by free credits).
Step 4: Start the Router
ccr start
Step 5: Point Claude Code at the Router
export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
claude
Step 6: Monitor and Optimize
Watch which routes consume the most credits. Adjust routing rules to maximize free credit usage and minimize paid spend.
Frequently Asked Questions
Is Claude Code Router free?
Yes, Claude Code Router is open-source and free to install. You only pay for the underlying API providers it routes to. With free credits via AI Perks, the entire setup can run at $0 in API costs for months or years.
Does Claude Code Router work with Anthropic's official Claude Code?
Yes. Claude Code Router intercepts requests from the official Claude Code CLI by setting ANTHROPIC_BASE_URL to the router's local address. The router then forwards requests to whichever provider you configured for that task type.
What's the difference between Claude Code Router and LiteLLM?
Claude Code Router is purpose-built for Claude Code with task-aware routing. LiteLLM is a more general LLM gateway that works with any client. Both can serve similar purposes; Claude Code Router has tighter integration with Claude Code's specific request patterns.
Can I use Claude Code Router for privacy-sensitive code?
Yes. Configure routing rules to send sensitive prompts to local Ollama or self-hosted models. Public/non-sensitive prompts route to cloud providers. This gives you Claude-quality coding assistance without exposing private code to external APIs.
How much can Claude Code Router save me?
Typical savings range from 50-99% of API costs depending on your routing strategy. Routing background tasks to DeepSeek (~50x cheaper than Claude Opus) is the biggest cost reducer. Combined with free credits via AI Perks, real costs can drop to $0.
Does Claude Code Router work with OpenRouter?
Yes, OpenRouter is one of the supported providers. OpenRouter gives you access to 200+ models through a single API, so adding it to Claude Code Router effectively unlocks every model on OpenRouter (including free models like Llama variants).
Is Claude Code Router production-ready?
It's a community project, not officially supported by Anthropic. Quality is solid for personal/team use but not battle-tested at enterprise scale. For production AI products, consider purpose-built gateways like LiteLLM or Portkey alongside free credits from AI Perks.
Cut Claude Code Costs by 99% With Router + Free Credits
Claude Code Router alone saves 50-99%. Combined with free Anthropic, OpenAI, and Google Cloud credits, your effective Claude Code cost drops to zero. AI Perks provides:
- $1,000-$25,000+ in free Anthropic credits
- $500-$50,000+ in free OpenAI credits
- $1,000-$25,000+ in Google Cloud credits
- 200+ additional startup perks
Route smart. Pay nothing. Get free AI credits at getaiperks.com.