claude-code - 💡(How to fix) Fix Expose /status rate-limit percentages (Session, Week, Sonnet-only) to statusLine command [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56138Fetched 2026-05-05 05:57:13
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Code Example

{
     "rate_limits": {
       "session_used_pct": 25,
       "week_all_used_pct": 13,
       "week_sonnet_used_pct": 0,
       "session_resets_at": "2026-05-04T22:19:00Z",
       "week_resets_at": "2026-05-10T03:00:00Z"
     }
   }
RAW_BUFFERClick to expand / collapse

Problem

The /status slash command shows three rate-limit usage percentages (Current session, Current week all-models, Current week Sonnet-only) that are extremely useful for tracking subscription budget mid-session. However these values are only visible inside the /status dialog and are not accessible to a custom statusLine.command script.

What I tried

  • claude --print "/status" → returns "/status isn't available in this environment"
  • claude --print --output-format=json "/status" → same
  • ccusage (community CLI) has no limits subcommand
  • No file under ~/.claude/ (stats-cache.json, .claude.json, transcripts) contains the percentages — Anthropic's anthropic-ratelimit-* response headers are stripped before transcript persistence
  • OAuth-token-based API probing felt out of scope (likely ToS-grey)

Proposal

Either:

  1. Pass the three percentages as additional fields in the JSON the harness sends to the statusLine.command on every render, e.g.:
    {
      "rate_limits": {
        "session_used_pct": 25,
        "week_all_used_pct": 13,
        "week_sonnet_used_pct": 0,
        "session_resets_at": "2026-05-04T22:19:00Z",
        "week_resets_at": "2026-05-10T03:00:00Z"
      }
    }
  2. Or expose /status as a programmatically callable endpoint via claude --print (currently it answers "isn't available in this environment")
  3. Or write the values to a file under ~/.claude/ after each render so external scripts can read the latest cached state

Why

Right now I can show cwd, model, token-cost and context-% via ccusage statusline — but I cannot mirror the exact three numbers from /status. For people on Max plans who hit weekly Sonnet caps, surfacing this in the statusline (instead of having to type /status multiple times per session) would be a real-time-budget UX win.

Environment

  • Claude Code 2.1.x
  • macOS / VS Code extension
  • claude_max plan, organizationRateLimitTier: default_claude_max_5x

extent analysis

TL;DR

Modify the statusLine.command script to parse the output of a potential new API endpoint or file output that contains the rate-limit usage percentages.

Guidance

  • Investigate the feasibility of implementing one of the proposed solutions: passing the percentages as additional fields in the JSON, exposing /status as a programmatically callable endpoint, or writing the values to a file under ~/.claude/.
  • Verify that the chosen solution provides the required rate-limit usage percentages in a format that can be parsed by the statusLine.command script.
  • Consider the potential impact of the chosen solution on the overall system architecture and user experience.
  • Evaluate the trade-offs between the proposed solutions, such as ease of implementation, performance, and security.

Example

{
  "rate_limits": {
    "session_used_pct": 25,
    "week_all_used_pct": 13,
    "week_sonnet_used_pct": 0,
    "session_resets_at": "2026-05-04T22:19:00Z",
    "week_resets_at": "2026-05-10T03:00:00Z"
  }
}

This example shows the proposed JSON format for passing the rate-limit usage percentages.

Notes

The solution may require changes to the Claude Code 2.1.x API or the statusLine.command script. Additionally, the chosen solution should be compatible with the claude_max plan and the organizationRateLimitTier: default_claude_max_5x configuration.

Recommendation

Apply a workaround by implementing one of the proposed solutions, such as passing the percentages as additional fields in the JSON, as it seems to be the most straightforward approach to provide the required rate-limit usage percentages to the statusLine.command script.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING