ClaudeCodeMod

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.

In your shell
claude plugin marketplace add hamzafer/claude-code-mods
claude plugin install openai-balance@claude-code-mods
Open the repo

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

Estimated OpenAI API credit, today's spend, and the last call above the prompt
From the author's repo.

What it hooks into

  • session.startWhen a session starts
  • turn.completeWhen a turn ends
  • command.runWhen you run its slash command/openai-balance
  • ui.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
Repo
hamzafer/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

Other mods in Usage

cost-meterSingh-APHolds a commandDraws session cost, context fill, and the 5-hour and 7-day windows on the status line, plus each turn's cost. An optional budget asks before the next tool call.session-meterarasovicDraws a pane of context by category, the 5-hour and 7-day windows and their pace, and the last 30 tool calls and model requests.cache-timerarasovicDraws a countdown above the prompt until the prompt cache expires, then how many tokens the next message writes again.turn-footerarasovicDraws tool calls, subagents, requests, tokens, and cache hit rate under each answer, and the running tool in the spinner.search-meterarasovicDraws a status line for the model's searches: green found on the first try, yellow found after misses, red found nothing.statusline-anywhereNathanABDraws the status line you already configured, in color, above the prompt in Claude Desktop. In a terminal it stays out of the way.statuspanexuanji86Draws a card above the prompt: model, context gauge, 5-hour and 7-day limits, directory, branch, and session cost. Press the gauge and confirm to run /compact.cache-taxkaranb192Keeps the one-hour prompt cache warm while you step away, and stops a send into a cold cache once with the estimated rewrite cost.token-optimizeralexgreenshDraws a status bar above the prompt in the desktop app: session quality, context fill, a cache countdown, and the 5-hour and weekly limits, with buttons to clean up, start fresh, or keep the cache warm.context-inspectorYeonwooSungDraws what fills the context window and how much of it is waste: re-reads, near-duplicate output, and what compaction kept, with advice and its evidence.heatmaphamzaferDraws a GitHub-style grid of your Claude Code time in a pane, one square per day, with your streak, peak hours, and top projects.openrouter-balancehamzaferDraws your OpenRouter credit above the prompt: the balance with a gauge, today's spend, and the model the money mostly went to.
All 183 in Usage