Feature request: programmatic access to subscription plan usage (/usage data)
Feature request
Expose the plan-usage data that the interactive /usage command shows (weekly utilization percentage on Pro/Max subscription plans) in a machine-readable way.
Why
Long-running agent sessions can burn a large share of a weekly plan without the user noticing. My use case: I asked my agent to pause all work and snapshot its state when weekly usage crosses a threshold (90%). It cannot do that today - /usage is interactive-only, the percentage is not written to any local file, it is not included in the statusline input JSON, and there is no API endpoint for subscriber plan usage (the Analytics API covers Console organizations only). The only workaround is the human manually checking /usage and relaying the number.
Any of these would work
- A scriptable form, e.g.
claude usage --json, printing the same data the interactive command shows - Plan-usage fields in the statusline input JSON so a statusline script (or the agent via a hook) can read it
- A documented local cache file updated when
/usagerefreshes - A hook event or SDK surface that fires when utilization crosses configurable thresholds
Environment
Claude Code CLI on Windows 11, Max plan.
🤖 Filed with Claude Code at the account owner's request
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗