# OpenRouter

> Route one prompt across 300+ LLMs with a single API key.

[Canonical HTML page](https://top-mcps.com/mcp/openrouter) · [server.json](https://top-mcps.com/mcp/openrouter.json) · [methodology](https://top-mcps.com/about/methodology)

## Install

### Claude Desktop — `claude_desktop_config.json`

Paste under mcpServers. Fully quit and reopen Claude after editing.

```json
{
  "mcpServers": {
    "openrouter": {
      "command": "npx",
      "args": [
        "-y",
        "openrouter-mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
      }
    }
  }
}
```

### Claude Code — `CLI or .mcp.json`

Run from your repo. Commit .mcp.json to share with your team.

```shell
# export OPENROUTER_API_KEY=YOUR_API_KEY
claude mcp add openrouter -- npx -y openrouter-mcp
```

### Cursor — `.cursor/mcp.json`

Global path: ~/.cursor/mcp.json. Reload window after editing.

```json
{
  "mcpServers": {
    "openrouter": {
      "command": "npx",
      "args": [
        "-y",
        "openrouter-mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
      }
    }
  }
}
```

### VS Code — `.vscode/mcp.json`

VS Code uses the "servers" key (not "mcpServers").

```jsonc
{
  "servers": {
    "openrouter": {
      "command": "npx",
      "args": [
        "-y",
        "openrouter-mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
      }
    }
  }
}
```

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Open via Cascade → hammer icon → Configure.

```json
{
  "mcpServers": {
    "openrouter": {
      "command": "npx",
      "args": [
        "-y",
        "openrouter-mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
      }
    }
  }
}
```

### Cline — `cline_mcp_settings.json`

Open via the Cline sidebar → MCP Servers → Edit.

```json
{
  "mcpServers": {
    "openrouter": {
      "command": "npx",
      "args": [
        "-y",
        "openrouter-mcp"
      ],
      "env": {
        "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
      }
    }
  }
}
```

### Continue — `~/.continue/config.json`

Continue uses modelContextProtocolServers with a transport block.

```json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "npx",
          "args": [
            "-y",
            "openrouter-mcp"
          ],
          "env": {
            "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
          }
        }
      }
    ]
  }
}
```

### Codex CLI — `~/.codex/config.toml`

Codex uses TOML. Each server is a [mcp_servers.<name>] subtable.

```shell
# ~/.codex/config.toml
[mcp_servers.openrouter]
command = "npx"
args = [
  "-y",
  "openrouter-mcp",
]
env = { OPENROUTER_API_KEY = "${OPENROUTER_API_KEY}" }
```

### Zed — `~/.config/zed/settings.json`

Zed calls them "context_servers". Settings live-reload on save.

```jsonc
{
  "context_servers": {
    "openrouter": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "openrouter-mcp"
        ]
      },
      "env": {
        "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
      }
    }
  }
}
```

### ChatGPT — `ChatGPT → Apps directory`

OpenRouter doesn't ship a hosted HTTPS endpoint today. ChatGPT supports remote MCP servers only — to use this server in ChatGPT you'll need to deploy it to a public HTTPS URL first (e.g. via Cloudflare Workers or Vercel) or wait for an official remote build.

```none

```

## At a glance

- **Maintainer:** Community
- **Transport:** stdio
- **Auth model:** API key
- **Required secrets:** OPENROUTER_API_KEY
- **Supported clients:** Claude, Cursor, Any MCP-compatible client
- **License:** MIT
- **Language:** TypeScript
- **Latest version:** latest
- **Last verified:** 2026-05-26
- **GitHub stars:** 64 (fetched 2026-05-26T10:50:23.064Z)
- **Score:** 68/100 (rubric 2026-04 — see https://top-mcps.com/about/methodology)
- **Source:** https://github.com/heurist-network/heurist-mesh-mcp-server

## Security & scope

- **Access scope:** network
- **Sandbox:** Prompts and responses flow through OpenRouter's infrastructure. OpenRouter's privacy policy applies.
- **Gotchas:**
  - Sensitive prompts hit OpenRouter logs — check their data retention policy if compliance matters.
  - API key is account-scoped; one key per environment is good hygiene.

## Quick answer

**What it does.** Exposes OpenRouter's OpenAI-compatible chat-completions endpoint as MCP tools. List available models, query a specific model, and stream responses, all with cost tracking.

**Best for:**
- Multi-model evaluation
- Provider redundancy
- Accessing long-tail models
- Cost-tracking across providers
- Prompt prototyping

**Not for:**
- Highest-volume production
- Workflows that depend on provider-specific features (Anthropic prompt caching, etc.)

## Description

The OpenRouter MCP fronts a unified inference endpoint for Anthropic, OpenAI, Google, Meta, Mistral, DeepSeek, and many more model families. The agent picks the model by slug, OpenRouter handles routing, pricing, and fallback if a provider degrades.

## Why it matters

Comparing models or hedging across providers is a constant task in agent stacks. OpenRouter collapses that into one credential, one billing surface, and one consistent API.

## Key features

- 300+ models
- OpenAI-compatible API
- Automatic fallback
- Per-token cost tracking
- Single API key
- Streaming

## FAQ

### Is OpenRouter more expensive than going direct?

Marginally — OpenRouter takes a small margin on top of provider rates. The trade is one credential, instant access to new models, and zero direct-billing relationships.

### Does it support Anthropic prompt caching?

Partially. Some provider-specific features pass through; others are abstracted away. For maximum Claude-specific tuning, go direct.

### Can I see per-model cost?

Yes. Every prediction returns token counts and the dollar cost, so the agent can keep a running budget across model calls.

## Changelog

- **2026-05-26** — Refreshed install snippets and fact sheet; verified for 2026.
- **2025-01-15** — Initial directory listing.
