Llm Router logo

Llm Router

by ypollak2

Routes coding prompts across Claude, local models, and 20+ providers to reduce subscription usage and control cost.

Install Llm Router

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "ypollak2-llm-router": {
      "command": "uvx",
      "args": [
        "llm-routing"
      ],
      "env": {
        "LLM_ROUTER_ZERO_CLAUDE": "YOUR_VALUE_HERE",
        "LLM_ROUTER_ENFORCE": "YOUR_VALUE_HERE",
        "LLM_ROUTER_SLIM": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

ypollak2/llm-router routes coding prompts across Claude, local models, and more than 20 providers, including OpenAI, Gemini, Groq, Ollama, and Codex. Lifecycle hooks classify prompts, request a draft from a free or local model, and escalate toward paid models when needed. Claude Code users can run it without provider API keys on a Claude Pro or Max subscription, while additional keys expand the provider pool. Reach for it when subscription quota, per-request cost, or sensitive prompt handling matters; routed answers are advisory by default unless Claude suppression is enabled.

Use cases

  • Protect Claude Pro or Max quota from routine coding prompts
  • Route simple tasks to local or free models
  • Apply a daily spending limit to routed API usage
  • Keep secret-bearing prompts on loopback Ollama models
  • Orchestrate multi-step research and media requests

Key features

  • Routes prompts across 20+ model providers
  • Classifies prompts with lifecycle hooks
  • Falls back around provider failures and rate limits
  • Provides semantic deduplication and prompt caching
  • Supports media tools and multi-step orchestration
  • Reports routing status, costs, savings, and latency

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

7/8 checks healthy over the last 78d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8d ago via OSV.dev · llm-routing (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars119Stargazers on the source repository.
Last commit1d agoMost recent push to the default branch.
Directory activity5 viewsConfig copies, upvotes, and views on AllMCPs.

How Llm Router works

What ypollak2/llm-router does

ypollak2/llm-router routes coding prompts between Claude subscription usage, local models, free providers, budget models, and premium models. Its main use case is protecting a Claude Pro or Max five-hour quota from routine requests that can be handled by a cheaper or local model. It can also route paid API traffic according to task complexity and budget.

The project connects to more than 20 providers, including OpenAI, Gemini, Groq, Ollama, and Codex. Provider API keys are optional for the Claude subscription workflow; adding keys makes more providers available. Ollama is also used for loopback-only handling of routed prompts that contain detected secrets.

How it works

Lifecycle hooks inspect a prompt before the host model processes it. A regular-expression heuristic classifies some prompts immediately; prompts that cannot be classified use a default route. Routable prompts begin with a draft from a free or local model and move toward paid models only when required.

Drafts are advisory by default. Claude still handles the turn unless LLM_ROUTER_ZERO_CLAUDE=1 is set. Tool-call enforcement defaults to smart, which can hold selected tool calls until routing completes; LLM_ROUTER_ENFORCE=off disables that behavior.

Provider failures and rate limits trigger circuit breakers, allowing the router to skip an unhealthy provider instead of repeatedly retrying it. The router also supports semantic deduplication, prompt caching, a daily spend cap, media requests, and multi-step orchestration. Session summaries report savings against a baseline, tier mix, provider cost, latency percentiles, and top routes.

Setup and configuration

Install the Python package and command-line entry point with:

Terminal
pip install llm-routing
llm-router install
llm-router doctor
llm-router status

llm-router install targets Claude Code by default. Host-specific installation is available for Codex CLI, OpenCode, Gemini CLI, GitHub Copilot CLI, OpenClaw, Trae, Factory Droid, Claude Desktop, VS Code, Cursor, GitHub Copilot in VS Code, and Windsurf/Cascade. llm-router install --host all processes every supported host configuration in one pass.

The optional daily KPI job is installed only when requested or accepted during installation, and uninstall removes it. Python agents can use the router in process with Router(budget_usd=0.50).run(...); asynchronous code can call .arun(...), and the budget raises BudgetExceeded after the cap is spent.

Tools and capabilities

The default MCP surface exposes 12 front-door tools; setting LLM_ROUTER_SLIM=off exposes all registered tools. The broader installation provides 30 MCP tools, including:

  • llm_image, llm_video, and llm_audio for media requests.
  • llm_orchestrate for multi-step research workflows.
  • Routing, provider health, status, and diagnostic operations through the MCP and CLI surfaces.
  • Status output, terminal titles, and operating-system notifications showing the last routed model, savings, and provider health.

Secret-bearing routed calls are restricted to local Ollama handling or refused, unless a request explicitly uses the documented cloud: override. This protection applies to the router's text tools, gateway, and streaming paths, not to prompts already sent by a host to its own model.

Limitations and notes

Routed responses do not replace Claude turns unless LLM_ROUTER_ZERO_CLAUDE=1 is configured. Host capabilities differ: GitHub Copilot in VS Code is supported as a capability extension but does not provide cost routing. Pi and Kimi Code installation targets are planned and currently report an explanation rather than installing.

The prompt classifier is heuristic and only classifies a portion of measured prompts with confidence; the remaining prompts use a default route. Savings depend on the workload, and the status command separates verified and unverified savings rather than presenting one combined figure.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Llm Router

ypollak2/llm-router is an MCP server that routes coding prompts across free, local, budget, and premium model tiers through MCP tools and lifecycle hooks. It connects supported hosts to providers including OpenAI, Gemini, Groq, Ollama, and Codex, with routing, status, diagnostic, media, and orchestration capabilities.

Install it with `pip install llm-routing`, then run `llm-router install`. The default target is Claude Code; use `--host` for supported hosts such as Cursor, Claude Desktop, VS Code, Codex CLI, Gemini CLI, or Windsurf.

Yes, it can route through MCP tools and local models without provider API keys on a Claude Pro or Max subscription. Adding provider keys expands the available model pool.

It sends detected secrets only to Ollama models on a loopback daemon or refuses the request. The router disables semantic caching, cloud fallback, and HTTP proxy handling for these calls unless a request explicitly uses the documented `cloud:` override.

Yes, set `LLM_ROUTER_ZERO_CLAUDE=1` to prevent Claude from taking the turn. Without that setting, routed answers remain advisory and Claude handles the turn by default.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewLlm Router AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/ypollak2-llm-router?style=directory)](https://allmcps.com/mcp/ypollak2-llm-router)
HTML Embed
<a href="https://allmcps.com/mcp/ypollak2-llm-router"><img src="https://allmcps.com/api/badge/ypollak2-llm-router?style=directory" alt="Llm Router on AllMCPs" /></a>