Why usagebar updates when Claude Code is busy instead of polling, how it shares the usage endpoint's tight rate limit, and when it reads.

usagebar wants two things that pull against each other: numbers that are current while you work, and as few requests as possible to an endpoint that is tightly rate-limited. It gets both by reading when usage has actually moved, and by reusing reads Claude Code already made.

The constraint: a small, shared budget

The numbers come from the same endpoint Claude Code’s /usage uses. It is not publicly documented, and it is rate-limited per account, with the budget shared by every Claude Code session on that account. Every read usagebar makes is one Claude Code can’t.

What the author observed in December 2026 (not a documented limit):

  • reads 60 seconds apart ran for 14 minutes without being refused;
  • reads 20 seconds apart got 5 answers, then refusals (HTTP 429) for more than 3 minutes, some with Retry-After: 0.

That is roughly 5 reads per 5 minutes. Polling faster gets refused, and can leave Claude Code’s own /usage without an answer.

Three sources, cheapest first

1. Claude Code activity is the trigger

Claude Code appends every API response to a session transcript, projects/<project>/<session>.jsonl in its config folder. A write there means usage just moved.

usagebar keeps one file-system watch (FSEvents) on the config folder. It sees that files changed, never what is in them. When a transcript changes it waits 1.5 seconds for the burst of writes to settle, then reads the endpoint. While Claude Code is idle, nothing happens.

2. Claude Code’s own reads, for free

Claude Code saves its own reads of the same endpoint into .claude.json. When that file changes, usagebar picks the numbers up, after checking they belong to the signed-in account. Such a read costs usagebar nothing, and it counts toward the budget: usagebar treats it as its own last read when spacing the next one. Hovering over Refresh Now in the menu shows Claude Code cache as the source when that is where the numbers came from.

3. The endpoint, within budget

When usagebar does read the endpoint, it:

  • leaves at least 75 seconds between reads;
  • after a refusal, doubles that spacing (up to 10 minutes), and narrows it again after successful reads;
  • waits out Retry-After, using 5 minutes when the header is missing or under a minute, and remembers the wait across relaunches so a restart doesn’t spend a read too early.

While it waits, the menu shows “Rate limited until …” and Refresh Now is greyed out.

When it reads

Besides Claude Code activity, usagebar reads:

  • on launch;
  • when your Mac wakes;
  • when you open the menu, if the numbers are more than about a minute old;
  • a few seconds after a window resets;
  • every 15 minutes, to pick up usage from claude.ai or other machines;
  • when you choose Refresh Now.

All of these respect the spacing and any rate-limit wait above.

What to expect

Measured on the author’s Mac with Claude Code 2.1.333:

  • the bar updates about 2.3 seconds after a transcript write, when the last read was long enough ago;
  • while Claude Code keeps working, it updates every 75 seconds or so;
  • at idle usagebar used about 0.05% CPU and had a 14 MB memory footprint.

If numbers go 30 minutes without refreshing, the menu bar item dims.

Alternatives that were rejected

  • Per-request rate-limit headers. They only cover the 5-hour and 7-day windows (not Fable), and reading them needs a status line, a hook or a proxy installed into Claude Code.
  • Session transcripts alone. They carry token counts, but no utilization.
  • Polling faster. It gets refused, and can starve Claude Code’s own /usage.