Model Routing logo

Model Routing

Community
frankxai
model-routing

Intelligent model selection — routes tasks to Haiku (fast/cheap), Sonnet (balanced), or Opus (complex/strategic) by analyzing task complexity. Use when deciding which model to run, optimizing cost vs quality, or building a tiered routing layer.

Overview

Publisherfrankxai
Repositoryclaude-skills-library
Skill namemodel-routing
Stars
47
Forks
6
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by frankxai on GitHub. Read the source before you install it.

Installation

Install the Model Routing AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/frankxai/claude-skills-library/tree/main/free-skills/model-routing
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/frankxai/claude-skills-library.git /tmp/claude-skills-library
mkdir -p .claude/skills
cp -r /tmp/claude-skills-library/free-skills/model-routing .claude/skills/model-routing
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Model Routing in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Model Routing on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Model Routing is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Model Routing System

You have access to intelligent model routing. Before executing any task, analyze complexity and route to the appropriate model tier.

Current model IDs and pricing — Last verified: 2026-08-28. Re-verify at platform.claude.com before trusting these again; they have moved more than once in 2026. Haiku → claude-haiku-4-5 ($1.00 / $5.00 per 1M input/output) · Sonnet → claude-sonnet-5 ($2.00 / $10.00) · Opus → claude-opus-5 ($5.00 / $25.00, default). For the hardest long-horizon reasoning, escalate above Opus to claude-fable-5 ($10.00 / $50.00 — most capable; thinking is always on, no disabling it; reserve for genuinely demanding work). Model IDs are complete as written — never append a date suffix. The tiers below are model-agnostic.

Routing Decision Matrix

TASK COMPLEXITY ANALYSIS
────────────────────────────────────────────────────────────────

HAIKU (Fast, Cheap) - claude-haiku-4-5 - Use for:
├── Simple file operations (read, list, navigate)
├── Scaffolding and boilerplate generation
├── Deterministic transformations (format, lint, compile)
├── Status checks and health monitoring
├── SEO metadata generation
├── Deployment commands (after code is written)
├── Documentation formatting
├── Simple search and replace
│
│   Token cost: $1.00/1M input, $5.00/1M output
│   Latency: Fastest
│   Use when: Task has clear, unambiguous steps

SONNET (Balanced) - claude-sonnet-5 - Use for:
├── Feature implementation (standard complexity)
├── Bug fixes requiring analysis
├── Content writing (articles, social posts)
├── Code review and quality checks
├── Test generation
├── Refactoring with clear patterns
├── API integration work
├── Database schema design
│
│   Token cost: $2.00/1M input, $10.00/1M output
│   Latency: Medium
│   Use when: Task requires reasoning but not deep strategy

OPUS (Strategic, Complex) - claude-opus-5 - Use for:
├── Architecture decisions (system design)
├── Multi-agent coordination (council, swarm)
├── Strategic planning (business, product)
├── Complex debugging (multi-file, subtle bugs)
├── Security audits and vulnerability analysis
├── Enterprise AI system design
├── Book writing (narrative, character development)
├── Research synthesis (multiple sources)
├── Ambiguous requirements interpretation
│
│   Token cost: $5.00/1M input, $25.00/1M output
│   Latency: Slower; most capable of the routine tiers
│   Use when: Task requires deep reasoning, creativity, or strategy

FABLE (Hardest, escalation only) - claude-fable-5 - Use for:
├── Long-horizon agentic work where Opus already fell short
├── The single hardest step in an otherwise-Opus-routed task
│
│   Token cost: $10.00/1M input, $50.00/1M output
│   Latency: Slowest; thinking is always on (cannot be disabled)
│   Use when: Opus-tier reasoning wasn't enough — this is a ceiling, not a starting point

Automatic Routing Rules

When processing a request, apply these rules:

Route to HAIKU when:

  • User says: "deploy", "format", "lint", "check status", "list", "scaffold"
  • File patterns: *.config.*, package.json, tsconfig.json
  • Commands: /mcp-status, /inventory-status, /nextjs-deploy (execution phase)

Route to SONNET when:

  • User says: "write", "implement", "fix", "create", "build", "test"
  • File patterns: *.ts, *.tsx, *.py, *.md (content files)
  • Commands: /article-creator, /create-music, /spec, /generate-social

Route to OPUS when:

  • User says: "design", "architect", "strategy", "council", "analyze", "research"
  • Keywords: "enterprise", "system", "multi-agent", "complex", "strategic"
  • Commands: /starlight-architect, /council, /author-team, /research

Escalate to FABLE when:

  • Opus already ran on the task and the result fell short
  • The task is genuinely the hardest tier — long-horizon agentic work, not routine strategy
  • Never route here first; Fable is a ceiling for escalation, not a default

Cost Optimization

BEFORE (No routing):
  All tasks → Opus → $25.00/1M output tokens

AFTER (With routing):
  Simple tasks (40%) → Haiku  → $5.00/1M   = $2.00
  Medium tasks (45%) → Sonnet → $10.00/1M  = $4.50
  Complex tasks (15%) → Opus  → $25.00/1M  = $3.75
  ──────────────────────────────────────────────
  TOTAL: $10.25 vs $25.00 = 59% cost reduction

Implementation in Task Tool

When using the Task tool, specify model based on routing:

javascript
// Simple task - use haiku
Task({
  subagent_type: "Explore",
  model: "haiku",
  prompt: "List all files in src/"
})

// Medium task - use sonnet (default)
Task({
  subagent_type: "code-reviewer",
  model: "sonnet",
  prompt: "Review this PR for issues"
})

// Complex task - use opus
Task({
  subagent_type: "Plan",
  model: "opus",
  prompt: "Design the architecture for a multi-tenant SaaS platform"
})

Command-Level Routing

CommandDefault ModelRationale
/acossonnetRouter needs reasoning
/article-creatorsonnetContent creation
/create-musicsonnetCreative work
/infogeniussonnetResearch + creation
/starlight-architectopusStrategic design
/councilopusMulti-perspective
/researchsonnetInformation synthesis
/specsonnetFeature planning
/nextjs-deployhaikuExecution
/mcp-statushaikuStatus check
/inventory-statushaikuStatus check
/publishhaikuExecution
/polish-contentsonnetEditing
/review-contentsonnetQuality check

Escalation Pattern

If a haiku-routed task fails or produces poor results:

  1. Automatically escalate to sonnet
  2. If still failing, escalate to opus
  3. If opus itself falls short on a genuinely hard task, escalate to Fable — last resort, not a retry habit
  4. Log escalation for learning
haiku (attempt) → fail → sonnet (retry) → fail → opus (retry) → fail (rare) → fable (last resort)

Relationship to other routing configs

This skill is the estate's model-facts reference — current model IDs, context windows, and per-token pricing. It is not the only routing config in the estate, and on task-class routing decisions it does not have the final word:

  • starlight-evals/routing-table.json is the evidence-derived source of truth for task-class routing — which tier a task class should hit, backed by eval-round evidence and confidence scores rather than the judgment calls in this file. Where its route for a task class disagrees with the "Route to X when" rules above, the table wins.
  • agentic-ops-hub/fleet/model-routing.json and a referenced ~/.starlight/routing.toml are operational routing configs elsewhere in the estate. They route by abstract tier name (opus, sonnet, ...) and should resolve those names against this skill (or the evals table) rather than hardcoding their own model IDs or pricing.
  • This skill's job stays narrow: keep the model IDs, context windows, and pricing above correct and current. It is not merged with the other three configs here — this section exists only so the next agent knows which source to trust when they disagree.

Model Routing v1.1 - Implementing claude-flow's intelligent routing pattern. Last verified: 2026-08-28.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Model Routing AI skill do?

Intelligent model selection — routes tasks to Haiku (fast/cheap), Sonnet (balanced), or Opus (complex/strategic) by analyzing task complexity. Use when deciding which model to run, optimizing cost vs quality, or building a tiered routing layer.

Why use Model Routing on TypingMind?

Because you install it once and use it with any model. Model Routing is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Model Routing in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/frankxai/claude-skills-library/tree/main/free-skills/model-routing. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Model Routing?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Model Routing?

As many as you like. As long as a model supports skills, you can use Model Routing with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Model Routing AI skill free?

Yes. It is published on GitHub by frankxai under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇