claude-router
AGENTS.md1 starsChanged 2 months agoMITView on GitHub
claude-router is a local classifier that maps a prompt to a Claude tier and an optional scaffold. - route() returns category, model, tier, scaffold_key, scaffold_text, confidence, low_confidence, pricing, cost_per_1k, cost_per_1k_basis - pricing gives the routed model's exact base input and output list prices plus the as_of date and source URL - cost_per_1k is deprecated and input-only; never price a call from it alone - prices live in one catalog, src/claude_router/model_pricing.json, read by both routers — edit prices there only -…
- Installs packages
In this repository2 other files it gives its agents.
- llms.txtllms.txt
- claude-routerSkill
The file
Files
AGENTS.md
claude-router is a local classifier that maps a prompt to a Claude tier and an optional scaffold.
Use it for
- routing Claude prompts before the API call
- deciding when Haiku plus a scaffold is enough
- exposing a deterministic
modelandscaffold_keyin automation
Do not use it for
- non-Claude providers
- proving these exact routes transfer to every workload
- replacing evals on prompts that are outside the benchmarked categories
Minimal commands
pip install -e ".[dev]"
claude-router "Evaluate this research paper for methodological rigor"
claude-router --eval
pytest -qOutput shape
route()returnscategory,model,tier,scaffold_key,scaffold_text,confidence,low_confidence,pricing,cost_per_1k,cost_per_1k_basispricinggives the routed model's exact base input and output list prices plus theas_ofdate andsourceURLcost_per_1kis deprecated and input-only; never price a call from it alone- prices live in one catalog,
src/claude_router/model_pricing.json, read by both routers — edit prices there only - tiers are
haiku,sonnet,opus,fable; the default routing table uses the first three and low-confidence inputs fall back to Opus with no scaffold claude-router --evalscores routing againstsrc/claude_router/eval_prompts.json
Success means
- routing returns a valid Claude model ID and scaffold choice
- empty input fails fast
- the README quick-start example matches the actual package API
Common failure cases
- Ollama is not running or
nomic-embed-textis unavailable - custom routing data references a scaffold key that does not exist
- the pricing catalog is edited to a model ID the router does not route to, or to a unit other than
usd_per_million_tokens(both rejected at load) - teams assume the provided centroids match an unrelated prompt distribution
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.

