model-routing-strategy

model-routing-strategy is a skill for Claude Code from latestaiagents/agent-skills. It costs 48 tokens per session (2,839 once invoked), scanned A, original, MIT.

A guide for choosing different large language models (LLMs) for different tasks. It covers routing by task complexity, cost, speed, capability, fallback choices, and performance testing.

In plain words
What is it for?
Use it when an application works with multiple AI models or providers and needs automatic model selection or fallback behavior.
Why use it?
It helps applications avoid using an expensive or slow model for every request. It also provides a way to balance answer quality, response time, and spending.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the mlops plugin — 7 skills shipped together , and of llmops-guardian, latestaiagents

Good fit Use it when an application works with multiple AI models or providers and needs automatic model selection or fallback behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/latestaiagents/agent-skills/model-routing-strategy
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 latestaiagents/agent-skills --skill model-routing-strategy
Clone the repo
git clone --depth 1 https://github.com/latestaiagents/agent-skills

Made for: Claude Code.

Or install mlops, the plugin that ships this one along with the rest of its 7 skills.

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-strategy

README.md
[![agentmods](https://agentmods.dev/badge/skills/latestaiagents/agent-skills/model-routing-strategy/github.svg)](https://agentmods.dev/skills/latestaiagents/agent-skills/model-routing-strategy)
Your own site
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/model-routing-strategy"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/model-routing-strategy/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-strategy

Your own site · 80×15
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/model-routing-strategy"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/model-routing-strategy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,839 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00048 $0.02839
Opus 5 $0.00024 $0.01419
Sonnet 5 $0.00010 $0.00568
Haiku 4.5 $0.00005 $0.00284

Measured 7d ago against content hash 82c67b41f64a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

model-routing-strategy scanned grade A with 0 findings 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 7d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mlops/llmops-guardian/model-routing-strategy/SKILL.md · 360 lines

How it starts

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

Model Routing Strategy

Dynamically select the optimal model for each task to balance quality, cost, and latency.

When to Use

  • Building applications using multiple LLM providers
  • Optimizing costs while maintaining quality
  • Need different model capabilities for different tasks
  • Implementing fallback strategies
  • A/B testing model performance

Model Comparison Matrix

Capability vs Cost

Capability Best Models Cost Tier
Complex reasoning Claude Opus, o1 $$$
General tasks Claude Sonnet, GPT-4o $$
Simple tasks Claude Haiku, GPT-4o-mini $
Code generation Claude Sonnet, GPT-4o $$
Creative writing Claude Opus, GPT-4 $$$
Extraction/Classification Claude Haiku, GPT-4o-mini $

Latency Comparison

Model Typical Latency (TTFB)
Claude Haiku 200-400ms
Claude Sonnet 400-800ms
Claude Opus 800-1500ms
GPT-4o-mini 200-400ms
GPT-4o 400-700ms
GPT-4 Turbo 500-1000ms

Routing Strategies

Strategy 1: Complexity-Based Routing

type Complexity = 'simple' | 'medium' | 'complex';

interface Task {
  prompt: string;
  requirements: {
    needsReasoning: boolean;
    needsCreativity: boolean;
    needsAccuracy: boolean;
    maxLatencyMs?: number;
    maxCostUSD?: number;
  };
}

function assessComplexity(task: Task): Complexity {
  const prompt = task.prompt.toLowerCase();

  // Complex indicators
  const complexPatterns = [
    /analyze.*and.*compare/,
    /explain.*step.*by.*step/,
    /write.*comprehensive/,
    /evaluate.*trade.*offs/,
    /design.*architecture/,
    /debug.*complex/,
    /review.*security/
  ];

  // Simple indicators
  const simplePatterns = [
    /summarize.*briefly/,
    /extract.*from/,
    /classify.*as/,
    /format.*as.*json/,
    /translate.*to/,
    /fix.*typo/
  ];

  if (complexPatterns.some(p => p.test(prompt)) ||
      task.requirements.needsReasoning ||
      task.requirements.needsCreativity) {
    return 'complex';
  }

  if (simplePatterns.some(p => p.test(prompt))) {
    return 'simple';
  }

  return 'medium';
}

function selectModel(complexity: Complexity): string {
  const modelMap = {
    simple: 'claude-haiku-4-5',     // $0.25/$1.25 per 1M
    medium: 'claude-sonnet-4-6',  // $3/$15 per 1M
    complex: 'claude-opus-4-6'      // $15/$75 per 1M
  };

  return modelMap[complexity];
}

Read the full file on GitHub · 360 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. 7d ago First seen · 360 lines · 48 tokens per session scan A 82c67b41f64a

Subscribe to this mod's changes

model-routing-strategy is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 48 tokens to every session and 2,839 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.