OpenRouter MCP Server
OpenRouter MCP 服务器
用于发现和查询 OpenRouter 上 300 多种可用 AI 模型的 MCP (Model Context Protocol) 服务器。
功能
列出模型 — 浏览所有可用模型,包括定价、上下文限制和功能
搜索与筛选 — 按提供商、价格、上下文长度、功能(工具、视觉等)查找模型
比较模型 — 并排比较多个模型
获取详情 — 获取任何特定模型的完整元数据
缓存响应 — 5 分钟缓存以减少 API 调用
安装
pip install openrouter-mcp使用方法
在 OpenClaw 中使用
添加到你的 openclaw.json MCP 服务器配置中:
{
"mcp": {
"servers": {
"openrouter-models": {
"command": "openrouter-mcp",
"env": {
"OPENROUTER_API_KEY": "your-api-key"
}
}
}
}
}然后重启网关。代理现在可以使用 MCP 工具来查询 OpenRouter 模型。
注意:
OPENROUTER_API_KEY是可选的,但建议使用以获得更高的速率限制(200 次请求/分钟 vs 20 次请求/分钟)。 在此处获取你的密钥:https://openrouter.ai/keys
代理使用示例:
# Agent can now call MCP tools like:
list_models(sort_by="context_length")
search_models(query="claude", max_input_price=5.0)
get_model(model_id="anthropic/claude-sonnet-4.6")
compare_models(model_ids="qwen/qwen3.6-plus,anthropic/claude-sonnet-4.6")独立运行 (stdio)
export OPENROUTER_API_KEY=your-key
python -m openrouter_mcp.server可用工具
工具 | 描述 |
| 列出所有模型,支持可选的模态筛选和排序 |
| 通过 ID 获取特定模型的详细信息 |
| 按查询、提供商、价格、上下文、功能搜索和筛选模型 |
| 并排比较多个模型 |
| 强制从 OpenRouter API 刷新模型缓存 |
示例
按上下文长度排序列表模型
{
"name": "list_models",
"arguments": {
"modality": "text",
"sort_by": "context_length"
}
}搜索每 100 万 token 价格低于 $5 的 Claude 模型
{
"name": "search_models",
"arguments": {
"query": "claude",
"provider": "anthropic",
"max_input_price": 5.0,
"requires_tools": true
}
}比较 3 个模型
{
"name": "compare_models",
"arguments": {
"model_ids": "anthropic/claude-sonnet-4.6,qwen/qwen3.6-plus,openai/gpt-5.4"
}
}获取模型详情
{
"name": "get_model",
"arguments": {
"model_id": "anthropic/claude-sonnet-4.6"
}
}API 参考
list_models(modality, sort_by)
modality(str, 默认: "text"): 按输出类型筛选。选项:text,image,audio,embeddings,allsort_by(str, 默认: "name"): 排序方式:name,created,price,context_length
get_model(model_id)
model_id(str, 必填): 模型标识符,例如anthropic/claude-sonnet-4.6
search_models(query, provider, max_input_price, min_context, requires_tools, requires_vision, free_only)
query(str): 在模型名称/ID/描述中进行自由文本搜索provider(str): 按提供商筛选 (例如anthropic,google,openai)max_input_price(float): 每 100 万 token 的最大输入价格 (0 = 无限制)min_context(int): 最小上下文窗口大小requires_tools(bool): 仅限支持工具调用的模型requires_vision(bool): 仅限具有视觉/图像输入功能的模型free_only(bool): 仅限免费模型
compare_models(model_ids)
model_ids(str, 必填): 以逗号分隔的模型 ID 列表
refresh_cache()
强制从 OpenRouter API 刷新模型缓存。
速率限制
无 API 密钥:20 次请求/分钟
有 API 密钥:200 次请求/分钟
模型数据缓存 5 分钟
在此处获取你的 API 密钥:https://openrouter.ai/keys
许可证
MIT
贡献
欢迎贡献!请在 GitHub 上提交 issue 或 PR。
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lumishoang/openrouter-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server