Expose session/weekly usage-limit percentages via a local CLI command or cache file

Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 1, 2026

Problem

claude.ai/settings/usage shows exactly the numbers a heavy Claude Code user needs day to day — percent used of the rolling 5-hour session window and the rolling 7-day weekly window, plus reset times. But that data only exists behind the authenticated web app. There's no supported way to read it:

  • Local Claude Code transcripts (~/.claude/projects/**/*.jsonl) only contain raw token counts per turn, not percent-of-limit — the actual cap is plan-specific and isn't derivable locally.
  • The Admin/Usage Cost API is org-level spend reporting for Enterprise admins, not an individual seat's rate-limit status.
  • The only way to get the real numbers is to open that page in a browser, every time.

What I tried

Built a Windows taskbar widget to show this at a glance. Local-log token counts were easy to read and display, but they're an approximation, not the actual number I make decisions from. Automating a browser against the settings page to read the real percentages hit Cloudflare bot-detection immediately — correctly so; that's not a legitimate integration path, and I don't think Anthropic wants third-party tools scraping an authenticated page either.

Proposed solution

Expose the same data the settings page already renders, through a supported local channel. Any of these would work:

  1. A CLI subcommand, e.g. claude usage --json, printing current session %, weekly %, and reset times.
  2. A local cache file already-authenticated sessions refresh periodically (e.g. ~/.claude/usage-limits.json), readable by local tools without extra auth or network calls.
  3. A documented local status endpoint/IPC that desktop widgets could poll (similar in spirit to how the CLI itself presumably already fetches this to show in-session rate-limit warnings).

Any of the three turns "scrape an authenticated page" into "read a file" — much lower risk, and something Anthropic fully controls the shape of.

Why it matters

This is a genuinely common pattern for dev tools — battery meters, GitHub CLI's rate-limit headers, AWS CLI credential status — an always-visible indicator so people can plan work around a budget instead of finding out they've hit a wall mid-task. Given Claude Code already knows this data (it's presumably fetching it for the settings page and any in-CLI warnings), exposing it locally seems like a small lift with real value for anyone building a taskbar/menubar/statusline widget.

View original on GitHub ↗