You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Add /usage support to display real-time usage graph #94
Claude Code 2 has recently introduced a /usage command.
This feature allows users to check their current usage and remaining quota in real time, like this:
/usage
→ shows current consumption and remaining balance like following.
` Current session
██████████████████████████████████████████████████ 100% used
Resets 1am (Asia/Seoul)
Current week (all models)
█████████████ 26% used
Resets Oct 7, 8am (Asia/Seoul)
`
It would be great if ccstatusline could integrate this information as well and visualize it in the same graphical format as the other stats.
Expected Behavior:
Parse /usage output from Claude Code 2
Display both current and remaining usage as a graph within ccstatusline
Keep the style consistent with the existing statusline indicators
This would make it much easier to monitor usage at a glance.
Thanks for considering!
Reacted by Tom Ellis, Sergii Kabashniuk, Ray Shan, Frédéric Camblor, Tim Mackey, Danylo Kazymyrov, Easyway-IT-User, mangubee and Juan Abadie
The output of /usage is not written to the jsonl session transcript, so it's not possible to use it in the statusline. The only possible way to get this output, to my knowledge, is to basically proxy all calls to claude via a local proxy, then look at the response headers:
This is definitely do-able, however it would add more friction to the process as I'd need a background process running indefinitely, and the user would need to be able to launch claude with the ANTHROPIC_BASE_URL pointing to the local proxy every time.
I'm not ruling this out, it'll just require a disruptive architecture change. I feel like this would be better done as an opt-in if you want those widgets, rather than the default.
Reacted by Michał Ordon, 로건(logan.xt), hizmarck, deejay189393, Tom Ellis, Erik Hodges, Tony Dehnke and Angelo Verlain
Would it be possible to fetch it from anthropic api?
❯ TOKEN=$(security find-generic-password -s "Claude Code-credentials" -w | jq -r '.claudeAiOauth.accessToken')
# Hit the API
curl -s "https://api.anthropic.com/api/oauth/usage" \
-H "Authorization: Bearer $TOKEN" \
-H "anthropic-beta: oauth-2025-04-20"
{"five_hour":{"utilization":28.0,"resets_at":"2025-11-28T06:00:00.445118+00:00"},"seven_day":{"utilization":3.0,"resets_at":"2025-12-05T01:00:00.445134+00:00"},"seven_day_oauth_apps":{"utilization":0.0,"resets_at":null},"seven_day_opus":null,"seven_day_sonnet":null,"iguana_necktie":null,"extra_usage":{"is_enabled":false,"monthly_limit":null,"used_credits":null,"utilization":null}}
granted this current implementation for fetching the oauth token is macos specific.
edit: sounds like on linux credentials are stored in ~/.claude/.credentials.json (untested)
Technically yes, that will work. However I’m not sure if it’s all good with Anthropic that we start hammering their usage endpoint every time the status line. I’ll do some investigation.
Technically yes, that will work. However I’m not sure if it’s all good with Anthropic that we start hammering their usage endpoint every time the status line. I’ll do some investigation.
Thanks; would definitely need caching; probably only needs to be updated every minute at most.
The widget implementation should work on Linux but perhaps @jonaustin@vildanbina it's worth checking this fork out. * check the uninstall paragraph as well when switching from the upstream to the forked ccstatus plugin
@spenpal claude-pulse uses the same API approach — GET /api/oauth/usage with the OAuth token from credentials. Same endpoint, same auth headers.
I've already implemented this as widgets in a fork: pcvelz/ccstatusline-usage (widget source). Session usage, weekly usage, reset timer, and context bar — all with caching and rate limiting.
@nikhilsitaram I believe the PR is still being reviewed on whether or not it's compatible with Windows -- from what it seems a hard requirement. The fork hasn't been merged yet enabling displaying the 5hr session and weekly limits:
Activity
sirmalloc commentedon Oct 1, 2025
The output of /usage is not written to the jsonl session transcript, so it's not possible to use it in the statusline. The only possible way to get this output, to my knowledge, is to basically proxy all calls to claude via a local proxy, then look at the response headers:
"anthropic-ratelimit-unified-5h-reset": "1759348800",
"anthropic-ratelimit-unified-5h-status": "allowed",
"anthropic-ratelimit-unified-7d-reset": "1759770000",
"anthropic-ratelimit-unified-7d-status": "allowed",
"anthropic-ratelimit-unified-fallback-percentage": "0.5",
"anthropic-ratelimit-unified-overage-disabled-reason": "org_level_disabled",
"anthropic-ratelimit-unified-representative-claim": "five_hour",
"anthropic-ratelimit-unified-reset": "1759348800",
"anthropic-ratelimit-unified-status": "allowed",
This is definitely do-able, however it would add more friction to the process as I'd need a background process running indefinitely, and the user would need to be able to launch claude with the ANTHROPIC_BASE_URL pointing to the local proxy every time.
I'm not ruling this out, it'll just require a disruptive architecture change. I feel like this would be better done as an opt-in if you want those widgets, rather than the default.
jonaustin commentedon Nov 28, 2025
Would it be possible to fetch it from anthropic api?
granted this current implementation for fetching the oauth token is macos specific.
edit: sounds like on linux credentials are stored in
~/.claude/.credentials.json(untested)https://codelynx.dev/posts/claude-code-usage-limits-statusline
sirmalloc commentedon Nov 28, 2025
jonaustin commentedon Nov 29, 2025
Thanks; would definitely need caching; probably only needs to be updated every minute at most.
pcvelz commentedon Dec 2, 2025
@jonaustin thank you for the inspiration. I exported this script with a healthy 60 seconds caching
Added as a custom command in ccstatusline
settings.json:{ "version": 3, "lines": [ [...] { "id": "ccusage-widget", "type": "custom-command", "commandPath": "~/.local/bin/ccstatusline-usage.sh" }, { "id": "XXXXXX-XXXXXX-XXXX-XXXX-XXXXXX", "type": "block-timer" } [...] ] }End result:
(edit: implemented rate limiting in example sh script)
pcvelz commentedon Dec 2, 2025
Ok I just created the script above today and noticed a few api limits, I updated the script above with some simple rate limits
tonydehnke commentedon Dec 5, 2025
Awesome, this works great! thank you
jonaustin commentedon Dec 22, 2025
Somewhat tangential, but for anyone that uses tmux; i created a little plugin to show usage stats if it's useful to anyone: https://github.com/jonaustin/claude-usage-tmux
vildanbina commentedon Jan 2, 2026
for anyone struggling to fetch credentials, especially on Linux, here is the snippet for Linux:
feat: add ccstatusline usage script with make install
pcvelz commentedon Jan 27, 2026
Since I was sharing the very simplistic SH script I created earlier more frequently I decided to create a fork for ccstatus + usage: https://github.com/pcvelz/ccstatusline-usage
The widget implementation should work on Linux but perhaps @jonaustin @vildanbina it's worth checking this fork out. * check the uninstall paragraph as well when switching from the upstream to the forked ccstatus plugin
sanjeevpenupala commentedon Feb 11, 2026
@sirmalloc Can this be revisited?
Seems like someone else was able to integrate usage limits in status line.
sirmalloc commentedon Feb 11, 2026
Yeah, I'll get on it.
feat: add API usage widgets (session, weekly, reset timer, context bar)
pcvelz commentedon Feb 11, 2026
@spenpal claude-pulse uses the same API approach —
GET /api/oauth/usagewith the OAuth token from credentials. Same endpoint, same auth headers.I've already implemented this as widgets in a fork: pcvelz/ccstatusline-usage (widget source). Session usage, weekly usage, reset timer, and context bar — all with caching and rate limiting.
PR submitted: #168
zac15987 commentedon Feb 26, 2026
For anyone using Windows, here’s a working snippet based on @vildanbina and @jonaustin’s solutions:
ccstatusline custom command:
result:
feat: add API usage widgets (session, weekly, reset timer, context bar)
feat: add API usage widgets (session, weekly, reset timer, context bar)
nikhilsitaram commentedon Mar 2, 2026
would love to see this supported natively @sirmalloc
pcvelz commentedon Mar 2, 2026
@nikhilsitaram I believe the PR is still being reviewed on whether or not it's compatible with Windows -- from what it seems a hard requirement. The fork hasn't been merged yet enabling displaying the 5hr session and weekly limits:
But the changes from this PR but it's already installable from here: https://github.com/pcvelz/ccstatusline-usage
feat: add API usage widgets (session, weekly, reset, context bar) (si…
feat: add API usage widgets (session, weekly, reset, context bar) (si…
feat: add API usage widgets (session, weekly, reset, context bar) (si…