claude-router
Skill1 starsChanged 2 months agoMITView on GitHub
Use when a call site needs a deterministic, local decision on which Claude model tier (Haiku/Sonnet/Opus) and prompt scaffold fits a given prompt before spending API tokens — claude-router classifies locally with embeddings and returns a model ID, scaffold text, and current list pricing. Local CLI/library, no MCP.
- Installs packages
4 other projects use a version of this.
Adopted by
Most recently taken up by
- syanga/astacktheir own version, first seen Nov 1, 2026
- connorch/skillstheir own version, first seen Oct 28, 2026
- vimoxshah/claude-routertheir own version, first seen Sep 23, 2026
- sonichi/sutandotheir own version, first seen May 17, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- sonichi/sutando★ 396same name
- vimoxshah/claude-router★ 3same name
- connorch/skills★ 2same name
- syanga/astack★ 0same name
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
Files
claude-router
claude-router is a local prompt router that picks the right Claude model tier and prepends the right scaffold using local embeddings, before you call the API. It classifies a prompt locally, chooses the right Claude tier, and prepends the right scaffold when scaffolding actually improves quality for that task category.
Use it for
- Deciding locally, before an API call, whether a prompt needs Haiku, Sonnet, or Opus and whether it benefits from a scaffold
- Getting the routed model's current list price alongside the routing decision so cost can be estimated per call
- Evaluating classifier accuracy on a labelled prompt set before trusting the
routing table in production (
--eval)
Do not use it for
- A general agent framework — it only returns a model ID and scaffold text, it does not call the Claude API itself
- Assuming these exact routes transfer unchanged to your workload — the bundled evidence was validated on the prior model generation and on the tool's own benchmark corpus
- Coding, design/debugging review, or operational tasks — the router deliberately sends these raw to Sonnet/Opus because scaffolds measurably hurt them
Quickstart
pip install claude-router
ollama pull nomic-embed-textfrom claude_router import ClaudeRouter
router = ClaudeRouter()
result = router.route("Evaluate this research paper for methodological rigor")
print(result["model"], result["scaffold_key"])
print(result["pricing"]["input_usd_per_mtok"], result["pricing"]["output_usd_per_mtok"])CLI:
claude-router "Write a blog post about Q2 results"Evaluate the routing table's classification accuracy:
claude-router --evalOutput shape
route(prompt): dict withmodel(Claude model ID),scaffold_key, andpricing(input/output $/MTok, basis, as-of date, source URL)build_prompt(prompt): the prompt with the selected scaffold prepended--eval: reportscategory_accuracy,tier_accuracy,misroutes, and a list-price cost comparison against routing everything to Sonnet
Common gotchas
- Requires a local Ollama instance with
nomic-embed-textfor embeddings — routing does not work without it, though--eval's scoring path is offline. - Low classifier confidence defaults to Opus as the safe fallback, not the category's normal route.
result["cost_per_1k"]is deprecated and input-only; useresult["pricing"]for anything that needs both input and output cost.- The routing table has not been re-validated on the current Sonnet 5 / Opus 5 generation for output quality — only for classification accuracy.
More
Full docs and CLI reference: https://github.com/hermes-labs-ai/claude-router
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
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.

