Track Claude Code session cost in real time

Claude Code Pro and Max plans are subscription-based, but if you're on a usage-based plan (or just curious about your consumption), Claude Code reports the token cost of each session. Headroom surfaces that number in the dropdown so you can see it without opening a terminal.

Cost data is reported by Claude Code itself — not computed by Headroom. It comes from the same local file as usage percentages. Zero network calls, no API key needed.

Where to find the session cost

Open the Headroom dropdown (click the menu bar item). The session cost appears as a line below the meters:

The cost reflects the current session since Claude Code last reset. When the 5-hour window rolls over, the counter resets. The number updates every time Claude Code updates its status line — typically each time you send a message.

Reading the cost from the command line

The same data lives in ~/.claude/headroom-usage.json. Pull it with jq:

# Session cost in dollars
jq '.sessionCost' ~/.claude/headroom-usage.json

# Full breakdown — cost + usage + model
jq '{cost: .sessionCost, session: .sessionUsagePct, week: .weeklyUsagePct, model: .modelName}' ~/.claude/headroom-usage.json

You can also use Headroom's --print flag (run from the app bundle):

/Applications/Headroom.app/Contents/MacOS/Headroom --print
# prints: render: cost="$0.34"

When cost is not available

The cost field is present only when Claude Code reports it. It's absent in some Claude Code versions or when the session is fresh with no activity. If the dropdown shows no "Session cost" line, Claude Code hasn't written a cost value yet — try sending a message and refreshing.

Log costs over time

To build a running cost log, add a cron job or shell function that reads the file periodically:

# Add to crontab: log cost every 30 minutes
*/30 * * * * jq -r '[now | todate, .sessionCost, .modelName] | @csv' ~/.claude/headroom-usage.json >> ~/claude-cost-log.csv

This produces rows like "2026-06-11T14:30:00Z",0.34,"claude-sonnet-4-5" — useful for a weekly cost summary or alerting when a session goes over budget.

What the session includes

The cost covers the 5-hour session window — the same window tracked by the session (5h) usage meter. It includes prompt tokens, completion tokens, and any tool call overhead. It does NOT include previous sessions (those have rolled off the 5-hour window).

Headroom shows session cost (and usage %) in your Mac menu bar — always visible, zero config, free.

Download Headroom — free

or: brew install --cask patwalls/tap/headroom

Related