Feature request: expose subscription usage percentages headlessly (stream-json rate_limit_event or `claude usage --json`)
Request
Expose the subscription usage percentages that the interactive /usage screen shows (5-hour and weekly window utilization) in a machine-readable way for integrations. Two natural shapes:
- Include utilization fields in the
rate_limit_eventalready emitted by--output-format stream-json, or - Add a
claude usage --jsonsubcommand.
Today
In headless use (-p / --output-format stream-json), the rate_limit_event only carries status-level data:
{"type":"rate_limit_event","rate_limit_info":{"status":"allowed","resetsAt":1784283600,"rateLimitType":"five_hour","overageStatus":"allowed","overageResetsAt":1785542400,"isUsingOverage":false}}
There is no percentage, and nothing is persisted locally. The percentages are only available inside the interactive /usage screen (via the authenticated /api/oauth/usage endpoint), which third-party tools rightly cannot and should not call with Claude Code's stored OAuth token.
Why
Orchestration tools that drive Claude Code as a subprocess (in our case CodeRelay, which coordinates Worker/Auditor handoffs between Claude Code and another CLI agent under one user's subscriptions) want to show the user their remaining 5h/weekly headroom so they can decide which provider takes the heavier implementation role and which takes the lighter review role. Status + reset time alone is a much weaker signal than "N% left this week".
For comparison, the Codex CLI records rate_limits snapshots (used_percent per window) in its session rollout files, so integrations can show real numbers without touching credentials.
Observed on Claude Code 2.1.209 (Windows x64, claude.ai Max subscription, authMethod: claude.ai).
Thanks!