Expose /usage subscription quota data in statusLine JSON payload
Status Closed — duplicate
Maintainer reply ✓ Yes — claude[bot]
Workaround ✓ Mentioned in thread ↓
Activity 15 comments · opened Feb 26, 2026 · closed Apr 26, 2026
💡 Likely answer: A maintainer (claude[bot], contributor)
responded on this thread — see the highlighted reply below.
Problem
The /usage REPL command shows subscription plan quota (daily limit, remaining messages, rate limit status) for Claude Max/Pro subscribers. However, this data is not included in the JSON payload piped to the statusLine command.
This means there is no way to display subscription usage in the status line, even though Claude Code already has internal access to this data.
Current workaround
Users have to open the Claude Desktop App or run /usage interactively to check their remaining quota. This is inconvenient and — in the case of the Desktop App — can cause .claude.json corruption due to concurrent file writes from both processes (see #3847 or similar).
Requested fields in statusLine JSON
{
"usage": {
"daily_messages_used": 42,
"daily_messages_limit": 100,
"daily_remaining_percentage": 58,
"rate_limit_reset_at": "2025-02-26T14:00:00Z",
"plan": "max_5x"
}
}
(Field names are suggestions — any structured representation would work.)
Why this matters
- The statusLine feature is designed for at-a-glance session info
- Subscription quota is the #1 thing users want to monitor continuously
- Without it, users resort to keeping the Desktop App open alongside CLI, which causes file contention on
~/.claude.json
Environment
- Windows 11, Claude Code CLI v2.1.59
- Claude Max subscription
- Using
statusLinewith jq filter
15 Comments
Feature request: Please expose Pro plan quota/usage data (5-hour session limit and weekly limit remaining) in Stop hook JSON payload or statusLine JSON.
Currently, the Stop hook JSON contains no fields for subscription usage data (daily_messages_used, weekly_remaining, rate_limit_reset_at, etc.), making it impossible to build hooks that automatically trigger session wrap-up logic before hitting usage limits.
Our use case: We need a Stop hook to detect when approaching the 5-hour or weekly Pro plan limit, and automatically execute a handover document generation and session state persistence before Claude Code shuts down.
Without this, the only available workaround is the undocumented
https://api.anthropic.com/api/oauth/usageendpoint, which is not officially supported and could break at any time.Requested fields (minimum viable):
quota.session_5h_remaining_pct(percentage remaining in current 5-hour window)quota.weekly_remaining_pct(percentage remaining in current weekly window)quota.session_reset_at(ISO8601 timestamp)quota.weekly_reset_at(ISO8601 timestamp)Related issues: #27829, #13585
I'm using Claude Max (20x) on Linux with a tmux-based system monitoring dashboard. I wanted to keep
/usagerate limit info visible at all times alongside docker stats, nvidia-smi, and htop.Since statusLine JSON doesn't include utilization data, I wrote a shell script that polls the undocumented OAuth usage endpoint every 60 seconds and renders the 5h/7d percentages as bars in a tmux pane:
<img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/0c73446a-d28c-4dfb-ab93-9cef781026be" />
If the
statusLineJSON payload included the utilization fields (five_hour, seven_day, seven_day_sonnet — matching what/usagealready displays), this would be trivially solvable without hitting any extra endpoints. It would also enable other creative integrations like polybar/waybar widgets, conky displays, etc.+1 for this feature.
Consolidation: 10+ duplicate issues requesting this exact feature
This issue captures the ask well, but it's worth highlighting how fragmented the demand has become. Here are all the open issues requesting quota/usage data in the statusLine JSON:
| Issue | Title | Filed |
|-------|-------|-------|
| #18121 | Expose rate limit/session usage data to statusLine configuration | Jan 29 |
| #22731 | Feature: Expose account usage/quota data to statusline | Feb 5 |
| #23843 | Expose rate limit / usage quota info in statusLine JSON input | Feb 7 |
| #26219 | Expose Plan Quota/Usage Data to StatusLine | Feb 16 |
| #27829 | Expose subscription quota/reset info in statusLine JSON | Feb 22 |
| #27915 | Expose rate-limit / plan quota usage in statusLine JSON input | Feb 22 |
| #28820 | Expose plan usage quota in statusLine JSON | Feb 25 |
| #28999 | Expose /usage subscription quota data in statusLine JSON payload | Feb 27 |
| #29911 | Expose rate-limit / plan quota data in statusline JSON stdin | Mar 1 |
| #30561 | Expose session/weekly token usage quota in statusLine JSON input | Mar 3 |
That's 10 independent issues from different users, all asking for the same thing: pipe the data that
/usagealready displays into thestatusLineJSON payload.Why this matters
The statusLine hook was a brilliant addition — it lets users build custom dashboards, waybar/polybar widgets, tmux panes, and terminal prompts. But without quota data, every user who wants usage visibility has to either:
/usage(interrupts flow)The data clearly exists server-side. The
/usagecommand already surfaces it. This is a plumbing change, not a new capability.Proposed payload addition
This would unblock an entire category of community tooling. Happy to help test if a preview lands.
cc @anthropics — can we get eyes on this? The volume of duplicates suggests strong community demand.
Please add this. Being able to view limit usage is the only reason to customize the statusline.
Another statusLine user here. I have a custom status line showing model, context tokens, cwd, and git branch. Plan quota (5h burst + weekly limit + reset times) is the last missing piece — I'd display it immediately if it were in the JSON payload. +1 for the proposed
quotafields.I've implemented a workaround for this using the OAuth API (
/api/oauth/usage) with theanthropic-beta: oauth-2025-04-20header. My statusline now shows:The approach uses stale-while-revalidate caching (5min TTL, 15min error backoff) to avoid rate limits within the 5s statusline timeout.
It works but requires extracting the OAuth token from
~/.claude/.credentials.json. Nativequotafields in the statusline JSON payload would be much cleaner — no external API calls, no caching layer, no auth token handling.Care to share?
Claude cooked this setup for me
(replaced
YOUR_MACOS_USERNAMEwith your macOS username)Requires
jq..claude/statusline-command.shAnd of course you add to your
~/.claude/settings.jsonI built claude-lens to solve this -- similar approach to @GuiSim's script (OAuth API + background refresh + file cache), but with a few extras:
+17%= headroom,-12%= slow down)~150 lines of Bash + jq, two commands to install:
Would love to see this data natively in the JSON payload though -- the OAuth API workaround adds latency and complexity that shouldn't be necessary.
Update (2026-03-19): Community workaround now available — @Astro-Han's claude-lens (~150 lines Bash + jq) solves this via the OAuth usage API with async background refresh, stale-while-revalidate caching (5min TTL), pace tracking, and Linux/macOS support.
Two-command install:
Native support is still the right fix — this shouldn't require polling an undocumented endpoint and doing your own auth token management — but claude-lens is a solid interim solution while this waits for prioritization.
@BareTread wow, this consolidated tracking is incredible, must have taken a while to dig up all 10 issues. And thanks for the claude-lens shoutout with full install commands! Really means a lot. Let me know if anything breaks or if you have ideas for improvements.
Shipped in 2.1.80 as
rate_limits, thank you so much for this!My status line now reads:
Significant UX upgrade.
A
PostToolUsehook can maintain approximate usage tracking that a statusLine script can read:Then in your statusLine script, read the tracker:
Add to settings:
This gives you a live usage display: tool call count, approximate token consumption, and context window percentage — all updated in real-time via the PostToolUse hook.
This is a duplicate of #18121, which was fixed as of version 2.1.80.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.