All shelves / Mods / Usage
openai-balance
By hamzafer
openai-balance is a Claude Code usage mod by hamzafer.
Draws your OpenAI API credit above the prompt: an estimated balance, today's spend, where the money went, and the last call.
Draws
Install
The marketplace name is claude-code-mods.
claude plugin marketplace add hamzafer/claude-code-mods claude plugin install openai-balance@claude-code-mods
It runs inside the Claude Code process. The side panel is only what the author's README names. Read the repo before you install, or run claude plugin validate on the plugin folder.
- Version
- 0.1.2
- License
- MIT
- Repo stars
- 381
- Last change
- 2026-10-15
What it can reach
- Draws in the session
- Reaches the network or an outside service
Claude Code 2.1.287 or later. The author says to restart after installing. Needs an OpenAI organization Admin key; read-only is enough. It comes from /config, else OPENAI_ADMIN_KEY, else the macOS Keychain item openai-admin-key, and is kept in memory only. OpenAI has no balance API, so the balance is an estimate: set it from your Billing page with /openai-balance 25.00, and the mod subtracts the spend the Costs API reports since then. Set it again after a top-up. The line is green from $5, yellow under $5, and red under $2, and says mostly and a model's name when today's money went mostly somewhere else. /openai-balance shows today, this month, the last 30 days, spend by line item, tokens by model and by key, and the last call. Today is the UTC day, as OpenAI's billing counts it. It refreshes every 10 minutes and after each turn, and a failed refresh keeps the last numbers, marked offline.
The marketplace, claude-code-mods, holds all of hamzafer's mods, openrouter-balance among them. This one installs on its own, or from the checklist that npx claude-code-mods@latest opens. Watching what API calls cost is why this page files it under usage. openrouter-balance, by the same author, draws your OpenRouter credit above the prompt: the balance with a gauge, today's spend, and the model the money mostly went to. This one has to estimate the balance, because OpenAI has no balance API. Calls to the Decisions API show as spend without a key or a time, because OpenAI's Usage API has no Decisions data yet; the author says the mod keeps asking, so they fill in once it does.
Demo

What it hooks into
session.startWhen a session startsturn.completeWhen a turn endscommand.runWhen you run its slash command/openai-balanceui.renderDraws into the sessionAbovePrompt
Read from the on() calls in its hook modules. Open its source under Files to check what each one does.
Slash commands 1
/openai-balanceOpenAI API credit, spend and tokens. Add an amount to set the balance after a top-up
Files
The author's source, 3 files. They load when you open them.
Facts
- Author
- hamzafer
- Category
- Usage
- Marketplace
- claude-code-mods
- Folder
- mods/openai-balance
- Version
- 0.1.2
- License
- MIT
- Repo stars
- 381
- Last change
- 2026-10-15
- Language
- TypeScript
- Files
- 7