MCP Directory

How to add llm-router to Claude Desktop

Local-first LLM router for AI coding tools — routes prompts to the cheapest capable model with automatic provider fallback. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.

Last updated June 14, 2026 · 33 · stdio · no auth

Claude Desktop config for llm-router

pip install llm-routing && llm-router install
{
  "mcpServers": {
    "llm-router": {
      "command": "llm-router",
      "args": [
        "install"
      ]
    }
  }
}

Setup steps

  1. 1Open Claude Desktop → Settings → Developer → Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
  2. 2Paste the llm-router config below under the top-level "mcpServers" key.
  3. 3Fill in any placeholder secrets (API keys, paths) in the snippet.
  4. 4Save the file, then fully quit and reopen Claude Desktop.
  5. 5Open a chat and confirm llm-router's tools appear under the 🔌 tools menu.

Before you start

  • Python 3.10+
  • An MCP host (Claude Code, Codex CLI, Gemini CLI, VS Code, or Cursor)
  • Optional provider API keys (e.g. OPENAI_API_KEY, GEMINI_API_KEY, OPENROUTER_API_KEY) or a local Ollama instance (OLLAMA_BASE_URL); works with zero keys on Claude Code Pro/Max

What llm-router can do in Claude Desktop

llm_route

Route a prompt to the most cost-effective capable model based on the active policy and provider chain.

llm_classify

Classify prompt complexity (heuristic or model-assisted) to drive routing decisions.

llm_auto

Automatic routing entry point used by hook-driven auto-routing.

llm_stream

Stream a routed model response.

llm_query

General-purpose text query routed through the free-first chain (primary manual tool for MCP clients like VS Code/Cursor).

llm_code

Code-oriented generation routed to an appropriate coding model.

llm_analyze

Analysis-oriented text task routed to a capable model.

llm_research

Research-oriented query, optionally using web-grounded providers.

Security

Runs locally with no hosted proxy, telemetry, or account. API keys live in local files (.env or ~/.llm-router/config.yaml) and are never transmitted by the router; keys are scrubbed from structured logs. Usage logs are stored as UNENCRYPTED SQLite at ~/.llm-router/usage.db — use full-disk encryption if needed (chmod 700 ~/.llm-router, 600 config.yaml recommended). Prompts are sent to whichever provider the router selects, so review each provider's privacy policy. The router cannot prevent provider-level jailbreaks or prompt injection. Hook scripts are local, inspectable shell scripts in ~/.claude/hooks/.

llm-router + Claude Desktop FAQ

Where is the Claude Desktop config file?

Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the llm-router config there under the "mcpServers" key and restart the client.

Is llm-router safe to use with Claude Desktop?

Runs locally with no hosted proxy, telemetry, or account. API keys live in local files (.env or ~/.llm-router/config.yaml) and are never transmitted by the router; keys are scrubbed from structured logs. Usage logs are stored as UNENCRYPTED SQLite at ~/.llm-router/usage.db — use full-disk encryption if needed (chmod 700 ~/.llm-router, 600 config.yaml recommended). Prompts are sent to whichever provider the router selects, so review each provider's privacy policy. The router cannot prevent provider-level jailbreaks or prompt injection. Hook scripts are local, inspectable shell scripts in ~/.claude/hooks/.

Do I need API keys to use it?

No. It works with zero API keys on Claude Code Pro/Max subscriptions, where routing uses MCP tools that only call external models when beneficial. Adding provider keys (e.g. OPENROUTER_API_KEY) widens the routing chain and unlocks policies like cost_aggressive.

What is the PyPI package name?

The package is `llm-routing` (`pip install llm-routing`); the CLI command and GitHub repo are named `llm-router`. The older `claude-code-llm-router` package is deprecated and redirects to `llm-routing`.

How do I add it to a host other than Claude Code?

Run `llm-router install` (defaults to Claude Code) or pass a host flag: `--host codex`, `--host gemini-cli`, `--host vscode`, or `--host cursor`. Any MCP client can also use the manual tools such as `llm_query`.

View repo Full llm-router page