claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Expose Claude Max plan usage quota in statusline JSON

Open crdiaz324 opened this issue 6 months ago • 3 comments

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When using Claude Code with a Claude Max subscription, I have no way to monitor my plan's usage quota from within the terminal. The statusline feature allows customizing the status bar with session data, but the JSON schema provided to statusline commands only exposes context window percentage and session-level information — it does not include account-level Max plan consumption (e.g., messages or tokens used vs. the current billing period limit).

Proposed Solution

Add a usage quota field to the statusline JSON payload, e.g.:

"account": {
  "plan": "max",
  "usage_percentage": 42.5,
  "usage_reset_at": "2026-06-01"
}

This would allow users to build status bar indicators (progress bars, color gradients, percentage labels) that surface Max plan consumption directly in the terminal alongside existing context window and model information.

Alternative Solutions

No response

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

No response

Additional Context

No response

crdiaz324 avatar May 16 '26 14:05 crdiaz324

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/12520
  2. https://github.com/anthropics/claude-code/issues/23078
  3. https://github.com/anthropics/claude-code/issues/55264

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar May 16 '26 14:05 github-actions[bot]

This is the session-scope vs account-scope split. The statusline JSON only sees what the current CLI session knows: context window, model, session cost. Your Max plan's rolling 5h window and weekly quota live server-side, behind the same internal endpoint https://claude-meter.com/r/iizrz6cw renders. Claude Code never pulls that, so it can't pass it to statusline. The data isn't missing, it's just not in this process. Local-log trackers like ccusage compute their own number that drifts from what the server enforces. claude-meter reads that server endpoint so the percent matches the settings page.

m13v avatar May 16 '26 21:05 m13v

The data lives at the OAuth usage endpoint, not in the per-session statusline process, so there's no in-process trick that synthesizes it. As a workaround until this lands natively, I built aistat, which reads it and emits the shape proposed here. The human view across accounts:

$ aistat -h
Claude usage
- [email protected] (active) [Max 5x]
  - 5-hour: 92.0% (resets in 4h 53m)
  - 7-day: 71.0% (resets in 2d 5h)
- [email protected] [Max 20x]
  - 5-hour: 4.0% (resets in 4h 12m)
  - 7-day: 12.0% (resets in 5d 9h)

Codex usage
- [email protected] (active) [Pro]
  - 5-hour: 25.0% (resets in 5h 16m)
  - 7-day: 18.0% (resets in 4d 18h)

and pulled down to the statusline fields via jq:

$ aistat usage claude | jq '.providers.claude.accounts[] | select(.active) | {plan, usage_percentage: .limits.five_hour.used_percent, usage_reset_at: .limits.five_hour.resets_at}'
{
  "plan": "Max 5x",
  "usage_percentage": 73,
  "usage_reset_at": "2026-05-29T23:14:00+00:00"
}

90s cache so an aggressive statusline refresh doesn't burn rate-limit budget. Same binary also covers Codex/Copilot for mixed statuslines.

https://github.com/drogers0/aistat

drogers0 avatar Jun 03 '26 23:06 drogers0