Feature request: expose subscription usage percentages headlessly (stream-json rate_limit_event or `claude usage --json`)

Status Open
Reported on v2.1.209
Maintainer reply None cached
Activity 0 comments · opened Jul 17, 2026

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:

  1. Include utilization fields in the rate_limit_event already emitted by --output-format stream-json, or
  2. Add a claude usage --json subcommand.

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!

View original on GitHub ↗