claude-code-mods

openrouter-balance

Your OpenRouter credit above the prompt: the real balance with a gauge, today's spend and the model the money mostly went to. By @krysmalskipl.

See what's happening Version 0.1.1

openrouter-balance: $2.67 of a $3.00 key limit left with a gauge, $0.33 spent today
A regular API key: what its limit leaves and today's spend.

Install

claude plugin marketplace add hamzafer/claude-code-mods
claude plugin install openrouter-balance@claude-code-mods

Restart Claude Code after installing. To try it without installing, clone the repo and run claude --plugin-dir mods/openrouter-balance.

How to use

Give it an OpenRouter key in /config. A management key (openrouter.ai → Settings → Management keys) shows the account balance and spend by model. A regular API key shows the balance too when OpenRouter allows it, plus its own spend and limit.

Run /openrouter-balance for the full breakdown.

/openrouter-balance

How it behaves

  • The balance is real, not an estimate: OpenRouter's /credits reports credits bought and used. OpenRouter documents it for a management key, which can't make model calls.
  • A regular API key shows the account balance when OpenRouter answers /credits for it, and else its own spend today and this month and what its limit leaves. Spend by model needs a management key.
  • Green from $5, yellow under $5, red under $2.
  • "Today" is the UTC day. A day first seen later than 00:15 UTC shows "since HH:MM" (your local time) instead of "today".
  • The key comes from /config, else OPENROUTER_MANAGEMENT_KEY, else OPENROUTER_API_KEY, else the macOS Keychain item openrouter-key, and stays in memory.
  • Refreshes every 5 minutes and after each turn. A failed refresh keeps the last numbers, marked offline.