# claude-router

Local Claude prompt router for model selection, scaffold selection, and cost-aware defaults.

Use this repo when you need to:
- route Claude prompts to Haiku, Sonnet, or Opus before calling the API (Fable 5.1 is
  a priced tier for custom routing tables; nothing routes there by default)
- apply a validated scaffold only for categories where scaffolding helps
- keep routing deterministic and local with Ollama embeddings

Primary interface:
- `claude-router "prompt text"`
- `ClaudeRouter().route(text)`
- `ClaudeRouter().build_prompt(text, route_result)`
- `claude-router --eval [cases.json]` / `claude_router.evaluate.evaluate(router, cases)`

Outputs:
- category
- model
- tier
- scaffold_key
- scaffold_text
- confidence
- low_confidence
- pricing (model_id, input_usd_per_mtok, output_usd_per_mtok, input_usd_per_1k,
  output_usd_per_1k, basis, as_of, source)
- cost_per_1k (deprecated; input tokens only)
- cost_per_1k_basis

Prices come from one maintained catalog, src/claude_router/model_pricing.json, read by
both the packaged router and the standalone router.py. They are base uncached non-batch
list prices carrying the date and URL they were read from. Pricing a call requires the
input and output rates together; cost_per_1k is the input rate alone.

Do not use this repo as:
- a general LLM gateway
- a guarantee that the benchmarked routing table matches every workload
- an agent framework or orchestration layer


## About Hermes Labs

Hermes Labs is an independent AI-reliability lab building open-source tools that catch silent failure modes in production AI. More at https://hermes-labs.ai

