Feature Request: Expose rate limit data in statusline JSON input

Resolved 💬 8 comments Opened Jan 20, 2026 by marty-at-propwiz Closed Apr 25, 2026

Feature Request: Expose rate limit data in statusline JSON input

Problem

Claude Code displays rate limit information in the /usage command (5-hour session usage %, weekly all-models %, weekly Sonnet-only %), but this data is not accessible programmatically for custom statusline scripts.

Currently, the statusline JSON input includes:

  • context_window.used_percentage - context window usage
  • cost - session cost data
  • workspace, model, etc.

But it does not include the account-level rate limits that appear in /usage:

  • Current 5-hour session usage %
  • Weekly all-models usage %
  • Weekly Sonnet-only usage %
  • Reset times for each

Current Workaround

The only way to get this data is to scrape the claude.ai/settings/usage webpage via browser automation (Safari/AppleScript on macOS). This is:

  • Heavy (requires keeping a browser tab open)
  • Platform-specific (macOS only with Safari)
  • Fragile (breaks if UI changes)
  • Slow (requires page refresh cycles)

Proposed Solution

Expose rate limit data in the statusline JSON input. The data already exists - it comes from anthropic-ratelimit-unified-* response headers that the API returns with every request:

  • anthropic-ratelimit-unified-status
  • anthropic-ratelimit-unified-reset
  • anthropic-ratelimit-unified-representative-claim

Suggested schema addition:

{
  "rate_limits": {
    "session": {
      "used_percentage": 23,
      "resets_at": "2026-01-20T12:00:00Z",
      "resets_in_seconds": 14400
    },
    "weekly_all_models": {
      "used_percentage": 16,
      "resets_at": "2026-01-26T07:00:00Z"
    },
    "weekly_sonnet": {
      "used_percentage": 2,
      "resets_at": "2026-01-26T16:00:00Z"
    }
  }
}

Alternative: Hook access

Alternatively, expose this data via a hook (e.g., Stop hook or new PostResponse hook) so users can capture and cache it themselves.

Use Case

Many users want to monitor their usage limits in real-time without leaving the terminal. A custom statusline showing:

main #123 · 🟢 23% 4h · 🟢 16% 5d · 🟢 2% S

...is much more useful than having to run /usage or check the web UI.

Environment

  • Claude Code version: 2.1.12
  • Platform: macOS (but this would benefit all platforms)

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗