agentleFS
alex-jbalex-jb/claude-tier-router/.claude/skills/tier-router/SKILL.md

tier-router

Skill1 starsChanged 7 months agoMITView on GitHub

Route Claude API calls to the right tier — Haiku for structured/fast tasks, Sonnet for reasoning. Use when building any Python app or Claude Code tool that makes multiple Claude API calls and you want to cut cost without losing quality.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. alex-jb/orallexa-ai-trading-agent★ 65100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    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.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    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
  1. Distinctive:

    When in doubt, start with FAST and only escalate if the output is visibly worse.

    line 26
  2. Distinctive:

    Don't: use DEEP for JSON extraction — Haiku handles schemas reliably and costs 4x less.

    line 69
  3. Distinctive:

    Don't: use FAST for open-ended critique or strategy review — Haiku produces vague output.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tier Router

A two-tier routing pattern for Claude API calls. Default for 80% of calls is Haiku — fast, cheap, and sufficient for structured work. Escalate to Sonnet only when the task needs real reasoning.

When to use each tier

FAST (Haiku) — use by default:

  • JSON extraction / structured output
  • Summarization of a paragraph into a sentence
  • Parameter generation with constraints
  • Classification (sentiment, category, intent)
  • Turning freeform text into a known schema
  • "Which of these is X" single-choice selection

DEEP (Sonnet) — use only when:

  • The task requires chains of reasoning over multiple facts
  • The output quality is user-facing and visibly matters (final report, strategy critique)
  • The decision has downstream cost if wrong (trade signal, architectural choice)
  • The input requires synthesizing information the model must weigh and trade off

When in doubt, start with FAST and only escalate if the output is visibly worse.

Cost math

Model$/1M input$/1M outputRelative cost
Haiku 4.5$0.80$4.001x
Sonnet 4.6$3.00$15.00~3.75x

Typical Claude Code session: ~80% structured tasks + ~20% reasoning.

  • All-Sonnet cost: 1.0 * $3.75 = $3.75 units
  • Tiered cost: 0.8 * $1 + 0.2 * $3.75 = $1.55 units
  • Savings: ~59% with no quality loss on the fast tier.

Real usage (orallexa trading agent) saw ~10x reduction because many calls are pure JSON parsing where Haiku is indistinguishable from Sonnet.

Install

pip install claude-tier-router

Usage

from anthropic import Anthropic
from tier_router import TierRouter

router = TierRouter(Anthropic())

# Structured -> Haiku
resp = router.fast(messages=[{"role": "user", "content": "Extract ticker as JSON: ..."}])

# Reasoning -> Sonnet
resp = router.deep(messages=[{"role": "user", "content": "Critique this strategy: ..."}])

# Inspect cost
print(router.cost_breakdown())
# {'fast_calls': 3, 'deep_calls': 1, 'fast_cost_usd': 0.002, ...}

Anti-patterns

  • Don't use DEEP for JSON extraction — Haiku handles schemas reliably and costs 4x less.
  • Don't use FAST for open-ended critique or strategy review — Haiku produces vague output.
  • Don't hardcode model strings across your codebase. Import FAST_MODEL / DEEP_MODEL from tier_router so model upgrades land in one place.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.