SuperAPI AI Directory

llm-router

Subscription-aware LLM router for Claude Code: routes tasks to providers like OpenAI, Gemini, Groq and Ollama by complexity, subscription usage and cost.

Open website

About this tool

Purpose

llm-router is a universal LLM router for AI coding tools. Its target scenario is: a user has already subscribed to a Claude Pro or Max plan, has not paid extra, yet still hits the five-hour usage limit—not because they asked too many questions, but because all prompts were sent to the advanced model, so simple questions like "what does this error mean," "reformat this JSON," or "is the service online" consume the same quota as questions that genuinely need the advanced model. llm-router intercepts prompts before the coding tool's own model sees them, first drafting answers with free or local models, then escalating up the fallback chain to paid models as needed.

Main capabilities

  • Free-first fallback chain: Officially claimed to reduce costs by 35–80%. Routable prompts are first drafted by free/local models, and only escalate up the chain to paid models when necessary.
  • Subscription-aware, no API key required: Under a Claude Pro/Max subscription, routing runs through MCP tools and local models and does not require an API key; adding provider keys can expand the available pool, but is not required.
  • Fits multiple hosts: Supports Claude Code, Cursor, Codex, Gemini CLI, Copilot, and others.llm-router install --host all Can install or print all host configurations at once.
  • Hooks interception and classification: Intercepts prompts before the coding tool's own model sees them, using free regex heuristics for instant classification; about half of real prompts can be scored with high confidence (788 out of 1,571 measured), and the rest fall back to defaults.
  • Usable draft and execution modes: Drafts are advisory by default—delivered to Claude as an unverified prompt, without replacing its turn, unless LLM_ROUTER_ZERO_CLAUDE=1is set. Execution takes effect at the tool-call level:smart(default) suspends selected tool calls until the prompt is routed;off turns that behavior off.
  • Safety and fault tolerance: Keys never leave the local machine—prompts containing API keys, tokens, or private keys are routed only to local models (fail-closed). Failed or rate-limited providers are automatically circuit-broken and skipped, rather than retried repeatedly.
  • Observability: Status line, terminal title, and OS notifications show the most recently routed model, savings, and health status; the end-of-session summary includes savings versus baseline, tier composition, per-provider cost, latency p50/p95/p99, and popular routes.
  • Multimodal and orchestration: Provides llm_image / llm_video / llm_audio, as well as llm_orchestratefor multi-step research.
  • MCP tool surface: Displays 12 front-door tools by default;LLM_ROUTER_SLIM=off shows all registered tools.
  • Runs locally: Runs entirely on the user's machine, with no hosted proxy, sends nothing to the llm-router service, and requires no account.
  • Grounding check:src/llm_router/grounding.py discards any draft that references files or functions not present in its context and indexed repository, and falls back to Claude.

Usage

Under a Claude Pro/Max subscription, it can be used without an API key, with routing done via MCP tools and local models; adding provider keys expands the provider pool, as detailed in guide/PROVIDERS.md. To install it into other hosts, use llm-router install --host all, which installs or prints each host's configuration at once. Full details for each host (including what each host genuinely cannot do) are in guide/HOST_SUPPORT_MATRIX.md.

The routing flow is: Hooks intercept the prompt before the coding tool's own model → free regex heuristics classify it instantly → routable prompts first get a free/local model draft → when necessary, escalate up the chain to paid models. By default, the draft is delivered to Claude as an advisory prompt and does not replace its turn; setting LLM_ROUTER_ZERO_CLAUDE=1 can change this behavior. At the execution level,smart(default) will suspend the selected tool call until the prompt is routed,LLM_ROUTER_ENFORCE=off can turn off this behavior. For the full mode and per-host overrides, see guide/GETTING_STARTED.md.

Applicable Scenarios

For individual developers and small teams: local cost savings, zero operational overhead, no hosted components whatsoever. If you need team-wide policy enforcement, audit export, SSO, or per-organization budgets, the official guidance points to a separate product, Chuzom.

Limitations and Caveats

  • Default nature of drafts: The answers obtained from routing are advisory by default—Claude will still take over that turn unless LLM_ROUTER_ZERO_CLAUDE=1is set. By default some tool calls will wait for the prompt to be routed;LLM_ROUTER_ENFORCE=off can turn this off.
  • Classification coverage: The free regex heuristic gives high-confidence scores for only about half of real prompts; the rest fall back to default values.
  • Nature of the savings figures: The savings data is a counterfactual estimate—how much the same tokens would have cost at API list price versus what was actually spent—not money saved on a flat subscription.llm-router status and llm-router savings-report report verified and unverified savings separately, each with its own n. The project does not publish a general savings percentage; any figure depends on the user's own workload. For the methodology and limitations, see docs/MEASUREMENT.md.
  • Security risk of direct execution:LLM_ROUTER_DIRECT_EXECUTION is enabled by default, and the local model gets write_file、edit_file and run_commandunder a restricted allowlist path; none of these can prevent targeted deletion,git push --force , or data exfiltration. It can be turned off via LLM_ROUTER_DIRECT_EXECUTION=false . For the full analysis, see SECURITY.md.
  • Benchmark status: llm-router is scored on the RouterArena benchmark—full split, 8,400 queries, scored locally using this repository's test framework, not yet independently verified. The current Arena Score is 72.35. For the full methodology and negative results (including a proxy split that skewed tuning by 4.25 points), see docs/ROUTERARENA.md.
  • Ground Truth accumulation: Optionally enabled (LLM_ROUTER_GROUND_TRUTH=1), it builds a replayable corpus of routing decisions rather than unrelated telemetry; it is off by default because this is the only part that writes prompt text to disk. For details, see guide/GROUND_TRUTH.md.
  • Self-audit: The self-audit is published in audit/ and docs/repo_goals/AUDIT-2026-09-25.md(13 met, 6 partially met, 1 not met), including negative results.

Other Information

  • Full index:guide/README.md
  • Contributing: see CONTRIBUTING.md
  • License: MIT License
  • Related links: Issues · Discussions · PyPI · Changelog