
Openrouter Admin
io.github.oviron由 GitHub 账号 oviron 发布v0.7.3更新于 Oct 24, 2026
MCP server for OpenRouter management API: credits, key CRUD, activity drill-down, dashboard.
概览
一个 MCP 服务器,让助手查看并在启用后管理 OpenRouter 账户:额度、推理密钥、护栏、用量与模型价格。
- 可以做什么
- 读取账户额度、当前 Provisioning 密钥以及所有推理密钥的限额与到期时间,并提供额度、活跃密钥和当日按模型消耗的一站式概览。按日期、密钥或用户筛选最近 30 天用量,并按模型、日期、提供商或密钥聚合,还可按生成 id 查询单次调用。浏览模型目录、单个模型详情、各提供商端点及其价格与可用率,以及符合 ZDR 的端点。列出护栏及其详情、密钥与成员绑定关系,并列出组织成员。启用写入工具后,可创建、更新和删除推理密钥与护栏,并批量绑定或解绑护栏到密钥和成员。
- 适用场景
- 适合在聊天客户端中查看 OpenRouter 花费、定位哪些密钥或模型消耗了额度、比较模型价格与端点,或管理密钥和消费护栏,而不必打开网页控制台。
- 运行要求
- 通过 npx 或全局 npm 安装以 stdio 在本地运行,需要 Node.js。需要 OpenRouter Provisioning API 密钥,放在环境变量 OPENROUTER_PROVISIONING_KEY 中;该密钥不同于推理密钥。写入工具还需将 OPENROUTER_ADMIN_ALLOW_WRITE 设为 1。需要通过网络以 HTTPS 访问 OpenRouter API。
安装
在 SourceWeft 中
- 打开 控制台中的 Openrouter Admin,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
openrouter-admin-mcp
[npm version] [npm downloads] [CI] [MCP Registry] [Node] [License: MIT]
MCP server for the OpenRouter management API — programmatic control of credits, inference keys, guardrails, organization members, and usage analytics from inside Claude Code, Claude Desktop, Cursor, or any MCP-compatible client.
Read-only by default. Destructive write operations are gated behind an opt-in env flag.
This is not an inference proxy. It uses an OpenRouter Provisioning API key, which can manage your account but cannot make completion calls.
Why
OpenRouter's UI is solid for one-off tweaks, but checking spend across keys, drilling into per-model/per-day usage, configuring account-wide guardrails, or rotating limits requires a lot of clicking. This server exposes those operations as MCP tools — Claude can answer "what burned my credits this week?", "create a temporary key with a $0.30 daily cap", or "bind the new prod key to our daily-$50 guardrail" in a single turn.
Features
26 tools wrapping the OpenRouter management API:
or_overview— one-shot dashboard: credits + active keys (with reset/expiration) + today's UTC burn by model.- Inference key CRUD including
limit_reset(daily/weekly/monthly) andexpires_at. - Guardrails CRUD — account-wide spending limits with provider/model allowlists, ZDR enforcement. Bulk-assign to keys or org members.
- Activity drill-down — aggregate
by_model,by_day,by_provider, orby_key. Token-level breakdown (prompt / completion / reasoning) per row. - Generation lookup — fetch any single inference call by
gen-…id (cost, tokens, latency, finish reason). - Model & endpoint discovery — current pricing per 1M tokens, per-provider uptime, ZDR-compliant endpoints.
Plumbing: HTTP retry on 429/5xx with Retry-After support, in-session GET cache, write invalidation. Returns raw fields — interpretation is left to the agent.
Install
One-click
[Install in VS Code] [Install in Cursor]
Replace the placeholder
sk-or-v1-...with your real key after install.
Manual
Run via npx (no install needed) or install globally:
Configuration
Create a Provisioning key at https://openrouter.ai/settings/provisioning, then add the server to your MCP client config.
Claude Code (~/.claude.json) or Claude Desktop (claude_desktop_config.json):
Restart your client to load the server. By default this gives read-only access — to enable key creation, mutation, and deletion, see Enabling write tools below.
Enabling write tools
Destructive operations (or_key_create, or_key_update, or_key_delete) are disabled by default to prevent accidental key mutation through prompt-injected tool calls. Add OPENROUTER_ADMIN_ALLOW_WRITE to your env block to enable them:
The server logs which mode it started in:
Read tools (or_overview, or_credits, or_current_key, or_keys_list, or_key_get, or_activity) are always available regardless of this flag.
Tools
Read (always available)
Write (opt-in via OPENROUTER_ADMIN_ALLOW_WRITE=1)
Example — create a daily-capped temporary key
Example — diagnose a cost spike
Example — bind a key to an account-wide guardrail
Design
The server returns raw API fields. It does not flag what's "near limit", what's an "anomaly", or what the agent should do — that's the agent's job. Composite tools (or_overview, or_guardrails_assignments) merge multiple endpoints into one workflow response, but they don't interpret. Rationale: production MCP servers (Stripe, GitHub, Linear) follow the same pattern.
Data handling
- The Provisioning key is read from the
OPENROUTER_PROVISIONING_KEYenvironment variable and forwarded only tohttps://openrouter.ai/api/v1/*over HTTPS. - The server is stateless across restarts. An in-session GET cache (60s TTL on
/credits,/key,/keys,/keys/{hash}) is held in memory only and dropped on shutdown. - The key never appears in error messages or tool output (verified by tests).
Development
Project layout:
License
MIT — see LICENSE.
来源:README.md,提交 66e660a
工具
0版本历史
1- v0.7.3最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分