技能 编程开发 OpenRouter 费用与用量查询

OpenRouter 费用与用量查询

v20261029
cost-openrouter
通过 API 查询 OpenRouter 的真实花费:密钥限额与今日/本周/本月用量、按 generation id 查询单次请求的计费成本、以及账户余额。运行前需用户确认,且绝不泄露 API 密钥。
获取技能
111 次下载
概览

Cost OpenRouter

Network skill. Ask the user before running it, and run it only with their yes.

node ${CLAUDE_PLUGIN_ROOT}/scripts/openrouter.mjs key --yes
node ${CLAUDE_PLUGIN_ROOT}/scripts/openrouter.mjs generation gen-abc123 --yes
node ${CLAUDE_PLUGIN_ROOT}/scripts/openrouter.mjs credits --yes

Rules

  • Without --yes the script prints the call it would make and sends nothing.
  • The key comes from OPENROUTER_API_KEY (credits: OPENROUTER_MANAGEMENT_KEY). A key the user stored as the plugin option openrouterApiKey arrives as OPENROUTER_API_KEY too: the plugin's SessionStart hook puts it there for this session's commands when the variable is not already set (ADR-506). Never ask the user to paste a key, never print, log or write one.
  • OpenRouter's usage.cost / total_cost is authoritative; do not recompute it from list prices.
  • credits needs a management key (a normal key returns 403). A fresh generation can 404 briefly: retry.
  • BYOK rows carry the 5% OpenRouter fee in usage, the provider's charge in upstream_inference_cost: show both, labelled.
  • Fallback and openrouter/auto can change the billed model: report model and provider_name as returned.
信息
分类 编程开发
名称 cost-openrouter
版本 v20261029
大小 1.53KB
更新时间 2026-10-30
语言