Intelligent model orchestration for Claude Code - Automatically routes queries to the optimal Claude model (Haiku/Sonnet/Opus) based on complexity, reducing costs by up to 80% without sacrificing quality.
| What Exists | What Claude Router Does |
|---|---|
| Multi-provider routers (OpenRouter, etc.) | Intra-Claude optimization (Haiku/Sonnet/Opus) |
Manual /model switching |
Automatic routing via UserPromptSubmit hook |
| Generic LLM complexity scoring | Coding-task specific pattern recognition |
| External API wrapper approach | Native Claude Code integration using subagents |
Technical Achievements:
- Zero-latency rule-based classification with LLM fallback
- Token-optimized agent definitions (3.4k vs 11.9k tokens)
- Multi-turn context awareness and follow-up detection
- Persistent knowledge system across sessions
| Metric | Value |
|---|---|
| Classification latency | ~0ms (rules) or ~100ms (LLM fallback) |
| Classification cost | $0 (rules) or ~$0.001 (Haiku fallback) |
| Cost savings (simple queries) | ~80% (Haiku vs Opus) |
| Cost savings (mixed workload) | Est. 50-70% |
| Additional savings (orchestration) | ~40% on complex tasks |
# Step 1: Add the marketplace (one-time, per project)
/plugin marketplace add 0xrdan/claude-plugins
# Step 2: Install the plugin
/plugin install claude-router
# Step 3: Restart Claude Code session to activateThat's it! The plugin automatically routes queries - no configuration needed.
# Update
/plugin marketplace update 0xrdan-plugins
# Uninstall
/plugin uninstall claude-routerMigrating from old marketplace? If you previously installed via
claude-router-marketplace, run:/plugin uninstall claude-router@claude-router-marketplace /plugin marketplace remove claude-router-marketplaceThen follow the installation steps above.
Automatic routing works out of the box:
- Simple queries → Haiku (fast, cheap)
- Coding tasks → Sonnet (balanced)
- Complex analysis → Opus (powerful)
Manual override when needed:
/route opus "Design a microservice architecture"
/route haiku "What is JSON?"View statistics:
/router-stats| Command | Description |
|---|---|
/route <model> |
Override routing for a query |
/router-stats |
View usage statistics |
/learn |
Extract insights from conversation |
/knowledge |
View knowledge base status |
/orchestrate |
Execute complex tasks with forking |
/router-analytics |
Generate HTML dashboard |
/retry |
Retry with escalated model |
/router-plugins |
Manage plugin integrations |
See Configuration & Commands for full documentation.
| Document | Description |
|---|---|
| How It Works | Default vs Router behavior, cost savings |
| Routing Rules | Classification rules, example output |
| Configuration | All commands and settings |
| Knowledge System | Persistent learning across sessions |
| Architecture | Project structure, data flow |
| Roadmap | Completed phases, coming soon |
| Contributing | How to contribute |
Claude Router intercepts queries and routes them to the optimal model:
"What is JSON?" → Haiku (~$0.01) ✓ Fast, cheap
"Fix this typo" → Haiku (~$0.01) ✓ Fast, cheap
"Run all tests" → Sonnet (~$0.03) ✓ Balanced
"Design architecture" → Opus (~$0.06) ✓ Powerful
For complex tasks, the Opus Orchestrator delegates subtasks to cheaper models:
- Opus handles strategy → expensive reasoning
- Haiku handles file reads → cheap I/O
- Sonnet handles edits → balanced implementation
Result: Same quality, ~40% less cost on complex workflows.
See How It Works for detailed comparison.
Sharing and Contributions are welcome! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
Built for the Claude Code community | Report Issues | @dannymonteiro