← Back to Leaderboard
Lypollak2

ypollak2/llm-router

Hook- and MCP-based LLM routing for coding tools, with free and local models first

View on GitHub ↗
Engineering Health (Methodology)
A+ · 88/100
Maintenance Activity
● Updated yesterday
Latest Release
v16.2.0
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption13/25
Release Cadence20/20
License Clarity20/20
MCPCLILocal AI
Total Stars
★ 134
24h Growth
+1
7d Growth
+3
Forks
17

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

ypollak2/llm-router Star History (2026-03-28 - 2026-12-03) ALL-TIME STAR HISTORY (2026-03 – 2026-12) +133 in 250d · avg +1/day 142 71 0 2026-03-28: ★ 12026-04-18: ★ 132026-05-09: ★ 222026-05-30: ★ 262026-06-20: ★ 312026-07-11: ★ 492026-08-01: ★ 612026-08-22: ★ 722026-09-12: ★ 792026-10-03: ★ 932026-10-24: ★ 1192026-11-09: ★ 1252026-12-03: ★ 134 ★ 134 2026-03 2026-07 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

llm-router is a Python routing engine with host lifecycle hooks, an MCP server, and an in-process SDK. On hosts with prompt hooks, a regex heuristic assigns a route when it has enough signal and uses the default otherwise. An eligible prompt can go to a free or local model for a draft before escalating through the provider chain. The draft is an unverified hint by default, not a replacement for the host model's turn. The project’s grounding check rejects drafts that cite files or functions absent from both the available context and the indexed repository.

Routing and enforcement are separate: the default smart mode can hold selected tool calls until routing completes, while LLM_ROUTER_ENFORCE=off removes that gate. MCP clients get 12 tools by default, with the consolidated surface defined in src/llm_router/tool_surface.py. Python callers can use Router.run or Router.arun without a separate server. This distinction matters when selecting a host: Pi is MCP-only, and the Copilot extension in VS Code adds capabilities but does not perform cost routing.

Key Capabilities & Differentiators

Ollama, OpenRouter, Gemini, and Groq are among the available backends. YAML policies range from conservative through balanced (the default) to cost_aggressive. Circuit breakers skip failing or rate-limited providers, and the Python SDK can enforce a dollar budget. Beyond text, the tool surface includes image, video, and audio calls and a multi-step orchestration tool. Session summaries report provider cost, tier mix, and p50/p95/p99 latency. The measured heuristic confidently classified 788 of 1,571 prompts in one run; that is coverage, not classification accuracy or acceptance rate.

On covered routes such as the text router, gateway, and streaming, a detected secret sends the request directly to loopback Ollama or causes a refusal. The protected path bypasses the HTTP proxy, semantic cache, judge queue, and cloud fallback; a cloud: prefix can override the decision for one request. This is entrypoint-specific, not a system-wide data-loss prevention control. The Claude Code proxy logs detections without enforcing this rule, and opt-in cloud classifiers and some direct-execution paths are also outside it.

Trade-offs & Limitations

A conventional provider API proxy is simpler when the host already sends API-key traffic to a configurable endpoint and only needs model selection and failover. llm-router is more useful when a subscription workflow can use host hooks or MCP, but host capabilities vary and a draft can add latency without avoiding the premium turn. Savings reports compare actual spend with a counterfactual at API list prices, separating verified from unverified estimates and showing their sample counts. They do not measure cash saved on a flat subscription. RouterArena results were graded with the project's own harness and have not been independently verified.

The most consequential workstation default is direct execution: a local model can write or edit files and run commands. Path rules and static command checks are not an OS sandbox. For an initial rollout, disable this via LLM_ROUTER_DIRECT_EXECUTION=false unless you have reviewed the execution boundary. MIT licensing allows commercial use, but the local deployment does not itself supply organization-wide policy enforcement, SSO, or per-organization budgets.

Hardware & Deployment Guide

Use Python 3.11+ and install the llm-routing package. Run llm-router install for Claude Code or select a host with --host, then use llm-router doctor to check setup and llm-router status to see whether requests are being routed. The subscription-plus-local path does not require additional provider API keys; adding cloud credentials expands the provider pool. The router runs on the workstation, but cloud routes still require network access. Daily KPI scheduling requires consent.

The documented setup-local path for a Mac with at least 48 GB of RAM is opt-in; it downloads about 22 GB and keeps about 22 GB loaded in memory. The separate install --proxy-default step points Claude Code at the proxy with the local model. v16.1.2 added ownership checks for the 127.0.0.1:11435 listener around setup. v16.1.3 sets OLLAMA_NUM_PARALLEL=1 and OLLAMA_CONTEXT_LENGTH=131072 for launchd and systemd services to avoid multiplying KV-cache memory across parallel slots. The v16.1.1 loopback forward proxy for Claude Code Remote Control remains a beta, opt-in path.

Integration: Host lifecycle hooks can draft before the host model runs; MCP-only clients gain callable tools, not equivalent interception.
Routing policy: The default balanced policy tries eligible free or local models first, while circuit breakers skip failing or rate-limited providers.
Developer interface: The default MCP surface exposes 12 tools, and Python callers can use Router.run or Router.arun with a dollar budget that raises BudgetExceeded when spent.
Measurement: Status and savings reports separate verified and unverified estimates, each with its own sample count; the baseline is API list price, not a subscription bill.
Data handling: Covered text entrypoints route detected secrets directly to loopback Ollama or refuse the request by default; the rule is not universal across entrypoints.
Local operations: v16.1.3 sets Ollama concurrency to one and context length to 131,072 tokens for the managed runner to prevent extra parallel slots from multiplying KV-cache memory.
Best For

Individual developers and small teams that want to test free or local drafts for routine coding prompts, or add budgeted routing to a Python agent without deploying a separate service.

Skip If

You need identical behavior across IDEs, guaranteed subscription savings, or an organization-wide gateway with mandatory data controls and centrally enforced budgets.

Reviewed on 2026-12-01 · Grounded in GitHub README, root file tree & releases · Newer release v16.2.0 (2026-12-02) shipped after this reviewMethodology

Quick Start & Installation

MCPCLILocal AI
pip install llm-routing        # installs the `llm-router` command
llm-router install             # wire up Claude Code (default host)
llm-router doctor               # check provider connectivity and setup
llm-router status               # verify it's routing — est. savings vs baseline

Comparison vs. Top Coding, Skills & MCP Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
llm-router ★134+3PythonMITHook- and MCP-based LLM routing for coding tools, with free and local models fir
gemini-cli109.6k+376TypeScriptApache-2.0A Node.js terminal agent for enterprise Gemini coding workflows and MCP tools
oh-my-pi40.5k+483TypeScriptMITA Bun/Rust terminal agent for model-flexible coding with LSP and editor integrat
aider50.3k+78PythonApache-2.0A Git-integrated terminal CLI for editing code with cloud or local models.

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/ypollak2/llm-router.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

ypollak2/llm-router Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about llm-router

Does installing the MCP server make it intercept and replace every model turn?

On a host with lifecycle hooks, the router classifies the prompt before the host model sees it and can request a draft from another model. The draft is advisory by default: Claude still takes the turn unless you opt into zero-Claude mode. An MCP-only integration exposes tools to the host but does not by itself provide prompt interception.

Do I need 48 GB of RAM or a dedicated GPU to use the router?

No. The CLI and in-process SDK require Python 3.11 or newer, but local inference is optional. The documented 48 GB+ Mac setup downloads about 22 GB and keeps about 22 GB loaded in memory; those figures are for that setup, not a universal VRAM requirement. Size other Ollama configurations for the chosen model, context length, and parallel request count.

Can we self-host it commercially, and does that keep our code on-device?

The MIT license permits commercial self-hosting subject to its notice requirements. Running the router locally removes the need for a hosted router service, but does not make cloud routes private or offline. Review provider terms and data handling separately, and check SECURITY.md for the exact entrypoints in use: the Claude Code proxy logs secret detections rather than enforcing local-only routing, and several opt-in paths are also outside that protection.

When is this a better fit than a conventional API routing proxy?

For a client that already uses provider API keys and only needs endpoint-level model selection and failover, an API-only proxy is the simpler integration. Choose llm-router when a supported coding host can use hooks or MCP alongside a subscription session, or when a Python application should route in-process. Test the exact host and mode before treating either option as a way to reduce subscription usage.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining ypollak2/llm-router? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature ypollak2/llm-router on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare