Imported from ruvnet/ruflo (
plugins/ruflo-cost-tracker/skills/cost-openrouter/SKILL.md). Install upstream withnpx skills add ruvnet/ruflo --skill cost-openrouter. Copyright stays with the author.
name: cost-openrouter description: OpenRouter real spend — key limit and usage today/week/month, one request's billed cost by generation id, account credits. Use when asked what OpenRouter charged or whether a key is near its limit. Network and API key: asks first. argument-hint: "key | generation | credits" allowed-tools: Bash
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
--yesthe 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 optionopenrouterApiKeyarrives asOPENROUTER_API_KEYtoo: 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_costis authoritative; do not recompute it from list prices. creditsneeds 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 inupstream_inference_cost: show both, labelled. - Fallback and
openrouter/autocan change the billed model: reportmodelandprovider_nameas returned.
