r/ClaudeCode • u/Historical_Today5072 • 17h ago
Tips & Workflows Statusline that shows your real 5h and weekly limits, no scraping /usage
For a while I estimated plan usage by reading the session transcripts, weighting tokens by model price and back-solving a ceiling from /usage screenshots. It worked, sort of, but it drifted whenever the limits changed. Recent Claude Code versions now pass the actual numbers to the statusline on stdin, so the whole thing collapsed into about 100 lines of Node, half of which is the banked reset part.
What it shows, all as % used:
```
Opus 5.5 › 5h 17% › 7d 14% › ctx 5% 50k/1M › ↻ 10:40 › free reset, use by 12/10
```
- 5h / 7d come from `rate_limits.five_hour.used_percentage` and `rate_limits.seven_day.used_percentage`
- ctx is `context_window.used_percentage`, plus token counts from `current_usage` (input + cache creation + cache read, since output isn't resident) over `context_window_size`
- ↻ is when the 5h window resets, from `rate_limits.five_hour.resets_at` (epoch seconds)
- free reset is the soonest banked reset Anthropic has announced that hasn't expired yet, pulled from claude-resets.com (no auth, cached, refreshed in the background every 3 hours so the bar never waits on it). It's the public announcement, not your own account balance, since the statusline payload doesn't include that. It turns red 3 days before it expires, and once you've used it, `node statusline.js banked-used` hides it
- Any usage segment turns red at 90%
- On an API key session `rate_limits` is null, so those segments just drop off
The arrows are powerline chevrons, so you need a Nerd Font in your terminal (I use JetBrainsMono Nerd Font).
settings.json:
```json
"statusLine": {
"type": "command",
"command": "node \"$HOME/.claude/statusline/statusline.js\""
}
```
Script (save it as `~/.claude/statusline/statusline.js`): https://gist.github.com/plaxagoras/85ffe8d003d29abab977f5e2cec38048
Two things I learned from the old estimate version, in case anyone is still going that route. If you detect limit notices by matching text in the transcripts, your own statusline output ends up in there too and you'll calibrate off yourself. Real notices have `isApiErrorMessage: true`. And keep an eye on new model IDs, a missing entry in your price table weighs every token at zero.
Happy to hear what other people put in theirs.



