# Cost Openrouter

> Cost OpenRouter

- Skill: `ruvnet/cost-openrouter` (Agent Skill)
- Install (CLI): `npx get-skill add ruvnet/cost-openrouter`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ruvnet/cost-openrouter/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ruvnet (https://skillmd.com/u/ruvnet)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/ruvnet/cost-openrouter

---


# Cost OpenRouter

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

```bash
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.

