model-routing

model-routing is a skill for Claude Code from alinaqi/maggy. It costs 17 tokens per session (1,794 once invoked), scanned A, original, MIT.

A system that classifies each user request into one of nine complexity levels before an AI model handles it. It uses fallback classifiers and can reuse a cached decision when classification fails.

In plain words
What is it for?
Use it to classify prompts, choose models by task complexity, provide classifier fallbacks, and evaluate whether routing results can be verified.
Why use it?
It helps route simple work to cheaper or local models while reserving more capable models for harder requests, with backup paths when a classifier or tool fails.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: reads .claude/ paths; positional $N argument; runs codex exec.

Good fit Use it to classify prompts, choose models by task complexity, provide classifier fallbacks, and evaluate whether routing results can be verified.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alinaqi/maggy/model-routing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alinaqi/maggy --skill model-routing
Clone the repo
git clone --depth 1 https://github.com/alinaqi/maggy

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for model-routing

README.md
[![agentmods](https://agentmods.dev/badge/skills/alinaqi/maggy/model-routing/github.svg)](https://agentmods.dev/skills/alinaqi/maggy/model-routing)
Your own site
<a href="https://agentmods.dev/skills/alinaqi/maggy/model-routing"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/model-routing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for model-routing

Your own site · 80×15
<a href="https://agentmods.dev/skills/alinaqi/maggy/model-routing"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/model-routing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,794 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Excessive Agency · line 72
    Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
    Fix: Remove the model/provider override or disclose it prominently and require explicit operator approval before invoking an external coding CLI or billed model.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.01794
Opus 5.5 $0.00007 $0.00718
Sonnet 5.5 $0.00003 $0.00359
Haiku 4.5 $0.00002 $0.00179

Measured 1mo ago against content hash fd9ebdd97555, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

model-routing scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

├── qwen3 # Shell: curl to local Ollama API
skills/model-routing/SKILL.md · 174 lines

How it starts

The opening of the file, as written. The whole thing — 174 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Routing System

How Routing Decisions Are Made

Every user prompt goes through a 9-tier classification pipeline before any AI model processes it. The system answers three questions:

  1. Which model should handle this? — 9-tier cost/complexity classification
  2. Is the classifier itself working? — Cascading fallback (qwen3 → kimi → deepseek → cache)
  3. Can we verify the result? — Tool-level fallback + auto-evaluation

The Pipeline

User types prompt
    ↓
UserPromptSubmit hook fires (~/.claude/hooks/route-task-hook)
    ↓
Classifier: qwen3 (local, free) classifies into tier
    ↓  (fails?)
Classifier: kimi (local, free) retries
    ↓  (fails?)
Classifier: deepseek-flash (~$0.0001) retries
    ↓  (fails?)
Classifier: cached tier from last success
    ↓
Hook injects routing decision into Claude's context
    ↓
Claude delegates to the right model or handles directly

9-Tier Routing Table

Tier Model Input (per M) Output (per M) Handles
1 Gemini 2.5 Flash-Lite $0.10 $0.40 Bulk extraction, classification, CIG pipelines
2 DeepSeek V4 Flash $0.14 $0.28 Simple code, CRUD, test writing, small fixes
3 DeepSeek V4 Pro $0.44 $0.87 Multi-file features, refactors, debugging (~80% of work)
4 Gemini 2.5 Flash $0.15 $0.60 Multimodal (images, video, audio), brand analysis
5 Kimi K2.6 $0.60 $2.50 Code review, commit messages, diff summaries
6 Gemini 3.1 Pro + Search $1.25 $10.00 Deep research, Google grounding, 2M context
7 Codex varies varies Bulk generation, code review
8 Claude Sonnet/Opus $3-5 $15-25 Architecture, security, quality-critical

Delegation Commands

When the hook says "delegate to X", run the matching command and return its output:


# Tier 1 — Gemini Flash-Lite
~/bin/gemini --flash-lite "prompt"

# Tier 2 — DeepSeek Flash
~/bin/deepseek --flash "prompt"

# Tier 3 — DeepSeek Pro
~/bin/deepseek --pro "prompt"

# Tier 4 — Gemini Flash
~/bin/gemini --flash "prompt"

# Tier 5 — Kimi
~/bin/kimi --quiet -p "prompt"

# Tier 6 — Gemini Pro Search
~/bin/gemini --pro-search "prompt"

# Tier 7 — Codex
codex exec "prompt"

# Tier 8 — Claude
# Handle directly (no delegation)

Read the full file on GitHub · 174 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +6 lines fd9ebdd97555
  2. 2mo ago Changed · +8 lines · +17 tokens per session 82f75f78cf31
  3. 2mo ago First seen · 160 lines · 0 tokens per session scan A 1634fa9281f1

Subscribe to this mod's changes

model-routing is a skill published in the GitHub repository alinaqi/maggy (713 stars, last pushed 3d ago), licensed MIT. It adds 17 tokens to every session and 1,794 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

model-routing compared with skills from other repositories

model-routing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
model-routingalinaqi/maggySkill7133d agoMITA17Claude Code
claude-apihashgraph-online/awesome-codex-pluginsSkill1.6ktodayApache-2.0A53Claude Code, Codex
fastapiericrisco/rsc-harnessSkill6915d agoMITA94Claude Code, Codex
modalericrisco/rsc-harnessSkill6915d agoMITA78Claude Code, Codex
pythonericrisco/rsc-harnessSkill6915d agoMITA94Claude Code, Codex
djangoericrisco/rsc-harnessSkill6915d agoMITA84Claude Code, Codex
ai-ml-developmenttravisjneuman/.claudeSkill115yesterdayMITA43Claude Code