llm-router
Skill0 starsChanged 9 months agoMITView on GitHub
Selects the optimal LLM model and provider for each task based on complexity, cost budget, and capability requirements. Routes cheap tasks to Haiku/GPT-4o-mini and complex tasks to Sonnet/Opus/o1.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- Samueladewole/claude-skillstheir own version, first seen Oct 13, 2026
- baofeng-tech/agent-skills-sotheir own version, first seen Apr 28, 2026
- khanglvm/skillstheir own version, first seen Feb 28, 2026
- jamesrochabrun/skillstheir own version, first seen Nov 18, 2025
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- jamesrochabrun/skills★ 209same name
- khanglvm/skills★ 1same name
- baofeng-tech/agent-skills-so★ 0same name
- Samueladewole/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository185 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- 2000s-visualization-expertSkill
- 2026-legal-research-agentSkill
- adhd-daily-plannerSkill
- adhd-design-expertSkill
- admin-dashboardSkill
- agent-creatorSkill
- ai-engineerSkill
- ai-video-production-masterSkill
- anthropic-technical-deep-diveSkill
- api-architectSkill
- automatic-stateful-prompt-improverSkill
- background-job-orchestratorSkill
- bot-developerSkill
- caching-strategiesSkill
- career-biographerSkill
- chatbot-analyticsSkill
- checklist-disciplineSkill
- claude-ecosystem-promoterSkill
- clinical-diagnostic-reasoningSkill
- clip-aware-embeddingsSkill
- cloudflare-worker-devSkill
- code-architectureSkill
- code-necromancerSkill
- code-review-checklistSkill
- collage-layout-expertSkill
- color-contrast-auditorSkill
- color-theory-palette-harmony-expertSkill
- competitive-cartographerSkill
- component-template-generatorSkill
- computer-vision-pipelineSkill
- cost-accrual-trackerSkill
- cost-optimizerSkill
- cost-verification-auditorSkill
- crisis-detection-intervention-aiSkill
- crisis-response-protocolSkill
- cv-creatorSkill
- dark-mode-design-expertSkill
- database-design-patternsSkill
- data-pipeline-engineerSkill
- data-viz-2025Skill
- dependency-managementSkill
- design-accessibility-auditorSkill
- design-archivistSkill
- design-criticSkill
- design-justiceSkill
- design-system-creatorSkill
- design-system-documenterSkill
- design-system-generatorSkill
- design-trend-analyzerSkill
- devops-automatorSkill
- diagramming-expertSkill
- digital-estate-plannerSkill
- docker-containerizationSkill
- document-generation-pdfSkill
- drizzle-migrationsSkill
- drone-cv-expertSkill
- drone-inspection-specialistSkill
- email-composerSkill
- error-handling-patternsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 164
Wrong: Only optimizing for cost, ignoring that Opus takes 5-10x longer than Haiku.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LLM Router
Selects the optimal LLM model for each task. The single biggest cost lever in multi-agent systems — intelligent routing saves 45-85% while maintaining 95%+ of top-model quality.
When to Use
✅ Use for:
- Deciding which model to call for a specific task
- Assigning models to DAG nodes in agent workflows
- Optimizing LLM API costs across a system
- Building cascading try-cheap-first patterns
❌ NOT for:
- Prompt engineering (use
prompt-engineer) - Model fine-tuning or training
- Comparing model architectures (academic research)
Routing Decision Tree
flowchart TD
A{Task type?} -->|Classify / validate / format / extract| T1["Tier 1: Haiku, GPT-4o-mini (~$0.001)"]
A -->|Write / implement / review / synthesize| T2["Tier 2: Sonnet, GPT-4o (~$0.01)"]
A -->|Reason / architect / judge / decompose| T3["Tier 3: Opus, o1 (~$0.10)"]
T1 --> Q1{Quality sufficient?}
Q1 -->|Yes| Done1[Use cheap model]
Q1 -->|No| T2
T2 --> Q2{Quality sufficient?}
Q2 -->|Yes| Done2[Use balanced model]
Q2 -->|No| T3Tier Assignment Table
| Task Type | Tier | Models | Cost/Call | Why This Tier |
| Classify input type | 1 | Haiku, GPT-4o-mini | ~$0.001 | Deterministic categorization |
| Validate schema/format | 1 | Haiku, GPT-4o-mini | ~$0.001 | Mechanical checking |
| Format output / template | 1 | Haiku, GPT-4o-mini | ~$0.001 | Structured transformation |
| Extract structured data | 1 | Haiku, GPT-4o-mini | ~$0.001 | Pattern matching |
| Summarize text | 1-2 | Haiku → Sonnet | ~$0.001-0.01 | Short summaries: Haiku; nuanced: Sonnet |
| Write content/docs | 2 | Sonnet, GPT-4o | ~$0.01 | Creative quality matters |
| Implement code | 2 | Sonnet, GPT-4o | ~$0.01 | Correctness + style |
| Review code/diffs | 2 | Sonnet, GPT-4o | ~$0.01 | Needs judgment, not just pattern matching |
| Research synthesis | 2 | Sonnet, GPT-4o | ~$0.01 | Multi-source reasoning |
| Decompose ambiguous problem | 3 | Opus, o1 | ~$0.10 | Requires deep understanding |
| Design architecture | 3 | Opus, o1 | ~$0.10 | Complex system reasoning |
| Judge output quality | 3 | Opus, o1 | ~$0.10 | Meta-reasoning about quality |
| Plan multi-step strategy | 3 | Opus, o1 | ~$0.10 | Long-horizon planning |
Three Routing Strategies
Strategy 1: Static Tier Assignment (Start Here)
Assign model by task type at DAG design time. No runtime logic. Gets 60-70% of possible savings.
nodes:
- id: classify
model: claude-haiku-4-5 # Tier 1: $0.001
- id: implement
model: claude-sonnet-4-5 # Tier 2: $0.01
- id: evaluate
model: claude-opus-4-5 # Tier 3: $0.10Strategy 2: Cascading (Try Cheap First)
Try the cheap model; if quality is below threshold, escalate. Adds ~1s latency but saves 50-80% on nodes where cheap succeeds.
1. Execute with Tier 1 model
2. Quick quality check (also Tier 1 — costs ~$0.001)
3. If quality ≥ threshold → done
4. If quality < threshold → re-execute with Tier 2Best for nodes where you're genuinely unsure which tier is needed.
Strategy 3: Adaptive (Learn from History)
Record success/failure per task type per model. Over time, the router learns:
- "Classification nodes always succeed on Haiku" → stay cheap
- "Code review nodes fail on Haiku 40% of the time" → upgrade to Sonnet
- "Architecture nodes succeed on Sonnet 90% of the time" → don't need Opus
Gets 75-85% savings after ~100 executions of training data.
Provider Selection
Once model tier is chosen, select the provider:
| Model Class | Provider Options | Selection Criteria |
| Haiku-class | Anthropic, AWS Bedrock | Latency, regional availability |
| Sonnet-class | Anthropic, AWS Bedrock, GCP Vertex | Cost, rate limits |
| Opus-class | Anthropic | Only provider |
| GPT-4o-class | OpenAI, Azure OpenAI | Rate limits, compliance |
| Open-source | Ollama (local), Together.ai, Fireworks | Cost ($0), latency, GPU availability |
Cost Impact Example
10-node DAG, "refactor a codebase":
| Strategy | Mix | Cost | Savings |
| All Opus | 10× $0.10 | $1.00 | — |
| All Sonnet | 10× $0.01 | $0.10 | 90% |
| Static tiers | 4× Haiku + 4× Sonnet + 2× Opus | $0.24 | 76% |
| Cascading | 6× Haiku + 3× Sonnet + 1× Opus | $0.14 | 86% |
| Adaptive (trained) | Dynamic | ~$0.08 | 92% |
Anti-Patterns
Always Use the Best Model
Wrong: Route everything to Opus/o1 "for quality." Reality: 60%+ of typical DAG nodes are classification, validation, or formatting — tasks where Haiku performs identically to Opus. You're burning money.
Always Use the Cheapest Model
Wrong: Route everything to Haiku "for cost." Reality: Complex reasoning, architecture design, and quality judgment genuinely need stronger models. Haiku will produce plausible-looking but subtly wrong output on hard tasks.
Ignoring Latency
Wrong: Only optimizing for cost, ignoring that Opus takes 5-10x longer than Haiku. Reality: In a 10-node DAG, model choice affects total execution time as much as cost. Route time-critical paths to faster models.
No Feedback Loop
Wrong: Setting model tiers once and never adjusting. Reality: As models improve (Haiku gets smarter every generation), tasks that needed Sonnet last month may work on Haiku today. Record outcomes and adapt.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

