LabscoMCP early access ↗
ypollak2MCP SERVER

LLM Router

Route each prompt to the cheapest model that can still do the job — free or local first, your paid seat only when the task needs it — from inside Claude Code, Codex, Cursor or Gemini CLI.

by ypollak2 ↗Model Routing, Multi-Model Consultation & Cost ControlCommunity

LABSCO SUMMARY

The secrets rule is the part worth knowing before you route anything real.

A prompt that contains an API key, token or private key is routed to local models only, fail-closed — it cannot leak into an external provider because a cheaper tier happened to win. Around that, the useful habit is calling the classifier before the router: it shows the complexity verdict and the budget pressure that would drive the decision, so you can override rather than discover the choice after the bill.

What it is

A local-first routing layer exposed over MCP. A complexity classifier — regex heuristics for most prompts, a local Ollama or Gemini Flash call for the ambiguous ones — decides how hard a task is, then a free-first router walks up a chain of providers until one can handle it, with circuit breakers skipping providers that are failing or rate-limited. Cost is logged to a local SQLite database. There is no hosted proxy and no account.

What you get

  • Routing you can call directly or inspect: classify a prompt's complexity before committing, route with full parameter control, stream, or hand it off automatically — llm_classify, llm_route, llm_auto, llm_stream, llm_select_agent, llm_track_usage, llm_reroute
  • Task-shaped entry points that pick their own routing chain — factual questions, web-grounded research, long-form generation, deep analysis, code and edits — llm_query, llm_research, llm_generate, llm_analyze, llm_code, llm_edit
  • Media and multi-step pipelines — llm_image, llm_video, llm_audio, llm_orchestrate, llm_pipeline_templates
  • Spend and health visible while you work: usage, savings against baseline, provider health, budget and a dashboard, plus a session-end summary with tier mix, per-provider cost and latency p50/p95/p99 — llm_usage, llm_savings, llm_health, llm_providers, llm_budget, llm_dashboard, llm_set_profile, llm_quality_guard, llm_hook_health
  • A fail-closed secrets rule: a prompt containing an API key, token or private key routes to local models only and cannot reach an external provider
  • Setup, benchmarking and filesystem helpers, and Claude subscription usage tracking — llm_setup, llm_benchmark, llm_quality_report, llm_save_session, llm_fs_find, llm_fs_rename, llm_fs_edit_many, llm_fs_analyze_context, llm_check_usage, llm_update_usage, llm_refresh_claude_usage

Requirements

Python 3.11+ and pip install llm-routing — the PyPI name is llm-routing while the command is llm-router; the published version is 13.0.2. llm-router install registers it with Claude Code by default, and --host codex, --host gemini-cli, --host vscode or --host cursor targets the others. No API keys are required on a Claude Pro or Max plan; LLM_ROUTER_SUBSCRIPTION_PROVIDER opts into cost-inverted routing around a paid seat. Everything runs locally — no hosted proxy, no account — and cost data stays in a local SQLite database.

Setup effort

One command — pip install llm-routing