openrouter-balance
Reviewed
at commit e839261
New version, not yet reviewed
Sends data to OpenRouter (openrouter.ai), your API key only, to read your own balance
Your OpenRouter credit above the prompt: the balance with a gauge, today's spend and where the money mostly went. /openrouter-balance shows the breakdown.
0 upvotes
Log in to upvote or save- Made by
- Jakub Krysmalski
- Pinned commit
-
e8392612e80094e5e048907751555257da0eb790 - What we checked
-
Shows your OpenRouter credit, today's spend and your top model in a band above the prompt, and adds a /openrouter-balance command with a breakdown. It sends your own OpenRouter key to openrouter.ai every few minutes to read your balance; no prompts, code or files leave your machine. It looks the key up in settings, two environment variables or the macOS Keychain, and stores only a start-of-day usage mark.
Review details
Static review of the source at the pinned commit; not run. Delta review of the changes since 2114aec; the rest carries over from the review at that commit. The change adds a shared hooks/bands.ts: the band is now wrapped in a keyed Box and sorted with other band mods by an optional order file, <CLAUDE_CONFIG_DIR or ~/.claude>/claude-code-mods/bands.json, read once per session with $.env.get (CLAUDE_CONFIG_DIR, HOME) and $.fs.exists/$.fs.read and parsed as JSON inside a try/catch (a list of mod names, [] on any error). The file is only read, never written, and its content is only used to sort. Registers session.start (registers /openrouter-balance, starts a one-minute timer), turn.complete (refresh, main loop only), command.run and ui.render (AbovePrompt). Runtime calls: $.http.fetch to https://openrouter.ai/api/v1/key, /credits and /activity with the key as Bearer token, $.process.run only for printenv OPENROUTER_MANAGEMENT_KEY, printenv OPENROUTER_API_KEY and security find-generic-password -s openrouter-key -w (all fixed argv, no shell), $.store.get/set for the day mark, $.clock, $.ui.resolve. The key is held in memory only and never written to the store or shown. Refreshes at most every 5 minutes, retries after 1 minute on failure; failures are caught and show an error line. The ../types import is declaration-only. No npm dependencies. Fetch and key handling are unchanged in this version.
- What it uses
-
- Reads your prompts: no
- Sees tool calls: no
- Blocks or changes tool calls: no
- Reads or writes files: yes
- Runs programs on your machine: yes
- Calls the model (uses tokens): no
- Sends data over the network: yes
- Stores data: yes
- Shows something on screen: yes
- Hooked events
Made this mod? Add a badge to your README
Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.
[](https://modsforclaude.com/mods/openrouter-balance/)