Intelligent routing across AI models based on task type, budget, and availability.
Route your AI tasks to the best model automatically - whether it's Claude, ChatGPT, Gemini, or local Ollama models. Model Router helps you use the right tool for the job while managing costs and preserving your Claude usage for complex work.
# Add the marketplace to Claude Code
/plugin marketplace add mikemorgenstern/model-router
# Install Model Router
/plugin install model-router@mikemorgenstern-model-router
# Run setup wizard
/model-router:setupThat's it! Model Router will now help you choose the best model for each task.
Model Router is a recommendation system for Claude Code that:
- π Recommends the best model for your task (code review, reasoning, bulk work, etc.)
- π° Saves money by routing to cheaper models when appropriate
- π― Preserves Claude usage for complex tasks that need the best quality
- π Supports free local models via Ollama (Llama, DeepSeek, etc.)
- π Learns from your usage to personalize recommendations
- π Stays updated with community-driven model benchmarks
You: "I need to review this PR"
Model Router: Based on your setup:
1. GPT-5.2 via Codex CLI (preserves Claude, ChatGPT included)
2. Gemini 3 Pro via Gemini CLI (good quality, Gemini included)
3. Claude Sonnet (best quality, uses Claude subscription)
Run: codex exec -m gpt-5.2 "Review this PR: [paste diff]"
Or tell me and I'll use Claude.
| Provider | Models | Access | Cost |
|---|---|---|---|
| Claude | Opus 4.5, Sonnet 4.5, Haiku 4.5 | Built-in | $20/mo subscription |
| ChatGPT | GPT-5.2, GPT-5.2 Codex | Codex CLI | $20/mo subscription |
| Gemini | 3.0 Pro, 3.0 Flash | Gemini CLI | $20/mo subscription |
| Ollama | Llama 3.3 70B, DeepSeek R1 70B, Qwen 2.5 32B | Local | Free |
All model recommendations are backed by published benchmarks (HumanEval, SWE-bench, MMLU, etc.)
Choose how tasks are routed:
- Preserve Claude - Use ChatGPT/Gemini first, save Claude for complex work (default)
- Quality First - Always use the best model available
- Budget First - Maximize free/cheap models
- Ask Each Time - Review recommendations before routing
Model Router knows which models excel at:
- Critical Code - Production code, security-critical β Claude Opus
- Code Review - Refactoring, general coding β Claude Sonnet / GPT-5.2
- Reasoning - Math, logic, algorithms β DeepSeek R1 70B (free!)
- Simple Edits - Typos, formatting β Gemini Flash / Haiku
- Bulk Operations - Batch processing β Llama 3.3 70B (free!)
Enable tracking to let Model Router learn from your usage:
/model-router:configure trackingThen analyze patterns:
/model-router:learnModel Router will suggest improvements like:
- "GPT-5.2 has 100% success rate for your code reviews - promote to best?"
- "Gemini Flash struggled with reasoning - try DeepSeek R1 instead?"
Test any model with your own prompts:
/model-router:test gemini-3-proChoose between:
- Standard test suite (built-in prompts)
- Your folder prompts (Model Router scans your project for real examples)
- Custom prompts
After testing, optionally update your recommendations based on results.
| Command | Purpose |
|---|---|
/model-router:setup |
First-time setup wizard |
/model-router:help |
Show all commands and config |
/model-router:status |
Check available models and subscriptions |
/model-router:recommend [task] |
Get recommendation for a task |
/model-router:configure |
Change settings |
/model-router:test [model] |
Test a model's performance |
/model-router:learn |
Analyze usage and improve recommendations |
/model-router:update-models |
Pull latest community recommendations |
Model Router is a recommendation system - it doesn't intercept requests automatically (Claude Code doesn't expose those hooks yet). Instead:
- Session start - Shows status and routing recommendations
- Ask for recommendations -
/model-router:recommend code_review - Natural language - "What model should I use for reasoning?"
- You route - Tell Claude "use Gemini" or run CLI command directly
After setup, Model Router stores config in ~/.model-router/:
~/.model-router/
βββ config.yaml # Your preferences
βββ models.yaml # Model recommendations (customizable)
βββ tracking.jsonl # Usage data (if tracking enabled)
- Claude Code (you're already using it!)
- Python 3.9+ for environment detection
- Optional: Codex CLI for ChatGPT models
- Optional: Gemini CLI for Gemini models
- Optional: Ollama for free local models
The setup wizard guides you through installing what you need.
Every Claude Code session shows your routing status:
ββ Model Router βββββββββββββββββββββββββββββββββββββββββ
β Profile: balanced β Routing: ChatGPT + Gemini first β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Subscriptions: Claude β ChatGPT β Gemini β β
β Local models: Ollama β (2 models) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Recommended routing: β
β β’ Code tasks β GPT-5.2 (preserve Claude) β
β β’ Reasoning β DeepSeek R1 (free, local) β
β β’ Critical β Claude Opus (best quality) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Model Router ships with research-backed defaults, updated regularly:
- SWE-bench - Real GitHub issues (Claude Opus 80.9%)
- HumanEval - Coding benchmark (DeepSeek R1 96.1%)
- GPQA - Graduate-level reasoning (DeepSeek R1 94.5%)
- MMLU - Knowledge benchmark (Llama 3.3 86%)
See data/models.yaml for full benchmarks and citations.
Found a better model for a task? Submit a PR!
See CONTRIBUTING.md for guidelines.
Q: Does this use my API keys? A: No. Model Router only reads environment variables to check if keys exist. It never stores or transmits them.
Q: Can I use this without subscriptions? A: Yes! Ollama models are free. Claude is always available (you're using Claude Code). Subscriptions are optional for ChatGPT/Gemini access.
Q: Does tracking send data anywhere?
A: No. All tracking is local (~/.model-router/tracking.jsonl). Nothing is transmitted unless you explicitly choose to share anonymized stats with the community.
Q: Why doesn't it route automatically? A: Claude Code doesn't expose hooks to intercept requests. If that changes, we'll add automatic routing. For now, Model Router shows recommendations and you follow them.
Q: Can I customize model recommendations?
A: Yes! Edit ~/.model-router/models.yaml or use /model-router:learn to personalize based on your usage.
- VS Code extension for automatic routing
- Cost tracking across all services
- Team sharing of customized recommendations
- Integration with Claude Desktop (mobile)
MIT License - see LICENSE
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Updates: Watch this repo for new model recommendations
Made by Mike Morgenstern Built for the Claude Code community π