Skip to main content
skill CX Codex

llm-router · curiositech — Claude Code skill for picking the right LLM per task

llm-router picks a model and provider for each task by complexity, budget, and quality needs. Cheap work goes to Haiku, hard problems to Sonnet or Opus.

MIT 160 installs ★ 274 updated 2026-10-30

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add curiositech/some_claude_skills --skill llm-router -a claude-code
Open on GitHub

What llm-router does

The skill answers which model a given node in an agent pipeline should call. Classification, schema validation, formatting, and structured extraction go to Tier 1: Haiku or GPT-4o-mini, around $0.001 per call. Writing code, docs, and reviews go to Tier 2: Sonnet or GPT-4o, about $0.01. Decomposing ambiguous problems, designing architecture, and judging output quality need Tier 3: Opus or o1, roughly $0.10.

It lays out three routing strategies. Static assignment by task type at DAG design time captures 60–70% of possible savings. Cascading tries the cheap model first and escalates when quality falls short: it adds about a second of latency but saves 50–80% on nodes where the cheap model is enough. Adaptive routing logs successes and failures per task type, so the router learns over time; after roughly a hundred runs the README puts savings at 75–85%.

There are boundaries. The skill is not for prompt engineering — use prompt-engineer — nor for fine-tuning or comparing model architectures. Its only allowed tool is Read, so it does not execute anything on its own. The README claims 45–85% cost savings while keeping 95%+ of top-model quality; treat that as an estimate from the author, not a contract.

What it helps with

  • pick a model for a task instead of routing everything to Opus
  • cut API spend in a multi-agent system
  • assign models to DAG nodes while designing a workflow
  • build a try-cheap-first cascade
  • record per-task outcomes and tune routes over time

Example prompts for the agent

  • Pick a model for classifying incoming requests on a low budget
  • Which model should handle the code review node in my DAG?
  • Set up a cascading route for text summarization

How to install llm-router

1Skills CLI (Vercel)

npx skills add curiositech/some_claude_skills --skill llm-router -a claude-code

2Manually: put the files in place

~/.claude/skills/llm-router/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/llm-router/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about llm-router

How do I install llm-router in Claude Code?

Run npx skills add curiositech/some_claude_skills --skill llm-router -a claude-code. The skill lands in ~/.claude/skills/llm-router/SKILL.md.

What does llm-router do?

It matches an LLM and provider to the task: classification and extraction go to Haiku or GPT-4o-mini, code writing to Sonnet or GPT-4o, heavy reasoning to Opus or o1.

When is llm-router the wrong tool?

It is not for prompt engineering — use prompt-engineer — not for model fine-tuning, and not for academic architecture comparisons. Its only allowed tool is Read, so it runs nothing itself.

Source text

SKILL.md · MIT
---
name: llm-router
description: 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.
  Use when deciding which model to call, optimizing LLM costs, or building multi-model agent systems. Activate on "which model", "model selection", "route to model", "LLM cost", "model routing", "cheap
  vs expensive model". NOT for prompt engineering (use prompt-engineer), model fine-tuning, or training custom models.
allowed-tools: Read
argument-hint: '[task-description] [budget: low|medium|high]'
metadata:
  category: AI & Machine Learning
  tags:
  - llm
  - router
  - which-model
  - model-selection
  - route-to-model
  pairs-with:
  - skill: cost-optimizer
    reason: Model routing is the primary mechanism for implementing cost optimization decisions
  - skill: cost-accrual-tracker
    reason: Real-time cost data informs routing decisions to stay within budget constraints
  - skill: prompt-engineer
    reason: Prompt complexity analysis determines which model tier the router should select
---

# 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

```mermaid
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| T3
```

---

## Tier 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.

```yaml
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.10
```

### Strategy 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 2
```

Best 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.

© curiositech · MIT · curiositech/some_claude_skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

llm-router by other authors comes first.

llm-router jamesrochabrun llm-router routes requests to OpenAI, Grok, Groq, DeepSeek or OpenRouter via SwiftOpenAI-CLI. Runs in agent mode, supports model selection and MCP tools. CX Codex +1 149installs lemonade-router-builder amd lemonade-router-builder — a Claude Code skill that turns plain-English routing requirements into valid collection.router policy JSON for Lemonade Server. Builds configs offline without contacting the server. CX Codex +1 1,300installs cc10x-router-owned-harness romiluz13 cc10x-router-owned-harness — a Claude Code plugin that routes every request through a loop of specialist subagents and skills. It writes workflow state to disk so sessions survive compaction. ★ 167repo stars cost-aware-llm-pipeline affaan-m cost-aware-llm-pipeline is a Claude Code skill that routes simple tasks to cheaper models, tracks API spend, and caches prompts while preserving quality on hard requests. CX Codex +1 6,400installs llm-cost-optimization devops-skills llm-cost-optimization — a skill that helps your agent cut LLM API costs with caching, model right-sizing, batching and a self-hosting break-even check. CX Codex +1 370installs local-llm-router hoodini local-llm-router routes coding prompts to local language models inside air-gapped setups. Employs Serena MCP for codebase context without cloud access. CX Codex +1 ★ 301repo stars llm-cost-optimizer Alireza Rezvani llm-cost-optimizer audits token usage and cuts LLM API spend through model routing, caching, and prompt compression. Useful when API bills spike or before launching new AI endpoints. CX Codex +1 73installs

From the same set180

The whole set →
code-architecture code-architecture is a Claude Code skill for organizing code within a single application. It covers clean and hexagonal architecture, feature-based folders, dependency inversion, and module boundaries. CX Codex +1 169installs design-system-documenter design-system-documenter converts raw token files into developer documentation featuring reference tables, implementation code, and WCAG contrast checks. CX Codex +1 165installs win31-audio-design win31-audio-design — a skill that builds Windows 3.1-style UI audio: 8-bit sounds, Web Audio API code, and haptic coordination for web and mobile apps. CX Codex +1 165installs human-centered-design-fundamentals The human-centered-design-fundamentals skill helps assess how people understand actions and system state in an interface. Use it to investigate user errors and make products easier to understand. CX Codex +1 161installs systems-thinking systems-thinking is a Claude Code skill that maps stocks, flows, and feedback loops in complex systems. It kicks in for persistent problems or unintended effects of a policy or intervention. CX Codex +1 160installs hiring-manager-deep-dive hiring-manager-deep-dive prepares you for Staff+ hiring manager interviews, with frameworks for presenting project impact, handling disagreement, and showing leadership beyond your team. CX Codex +1 160installs design-accessibility-auditor design-accessibility-auditor audits designs, palettes and components for WCAG 2.1: contrast ratios, touch target sizes, focus indicators and screen reader support. CX Codex +1 157installs pixel-art-scaler pixel-art-scaler — a skill for Claude Code and five other platforms that upscales pixel art with EPX/Scale2x, hq2x/hq4x, and xBR — no AI, no blur. Each algorithm adds sub-pixels through pattern recognition rather than inventing texture. CX Codex +1 156installs

Project sponsors

Companies that keep this analytics open