claude-code - 💡(How to fix) Fix [FEATURE] Expose subscription usage (Pro/Max) via a documented API or CLI command [3 comments, 3 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#56041Fetched 2026-05-05 05:59:42
View on GitHub
Comments
3
Participants
3
Timeline
8
Reactions
0
Timeline (top)
labeled ×4commented ×3unlabeled ×1

Error Message

  • CI/pre-commit guards that warn before kicking off long agent runs
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Summary

Pro/Max subscribers can see their session and weekly usage at
https://claude.ai/settings/usage, but there's no documented way to read those same numbers programmatically. Please expose them via a
supported endpoint or a claude subcommand.

Problem

Heavy Claude Code users — especially those running it across multiple
machines or shells — want to keep an eye on their quota without context-switching to the browser. Today the only options are:

  1. ccusage and similar JSONL-based tools — these tally tokens
    from ~/.claude/projects/, which works for a single machine but
    can't aggregate usage across installs and doesn't know about the
    actual server-side quota counters (5-hour window, weekly limit).

  2. The undocumented GET /api/organizations/{org_id}/usage
    endpoint
    that claude.ai/settings/usage itself calls. Several
    community tools (sshnox/Claude-Usage-Tracker,
    hamed-elfayome/Claude-Usage-Tracker, lugia19/Claude-Usage-Extension,
    phuryn/claude-usage) rely on this with a scraped session cookie. It
    works, but it's brittle, undocumented, and arguably outside the
    spirit of the ToS.

  3. The Admin API (Usage and Cost API, Claude Code Analytics API)
    documented and supported, but requires an Organization Admin API
    key. Not available to individual Pro/Max subscribers.

So there's a real gap between "official + supported" and "actually
usable for an individual subscriber."

Proposed Solution

Either (or both) of:

  • claude usage --json — a Claude Code subcommand that returns the current 5-hour-window and weekly usage as structured JSON,
    authenticated by the same credentials the CLI already has.
  • A documented endpoint with the same data, callable with a
    user-scoped token (not Admin-only).

The shape returned by /api/organizations/{org_id}/usage is already roughly what's needed; this is mostly about making it supported.

Use cases this unlocks

  • Desktop panel/menu-bar widgets (GNOME Shell extension, macOS menu bar, Windows tray) showing live quota.
  • Shell prompt indicators (PS1 / starship segment).
  • CI/pre-commit guards that warn before kicking off long agent runs
    near the weekly limit.
  • Team dashboards aggregating usage across multiple developers'
    installs.

Today people are building all of these against the unofficial
endpoint; a supported surface would let the ecosystem stop depending
on something that can break without warning.

Multi-install angle

The reason a local-only solution (ccusage) doesn't close this gap: many of us run Claude Code on several machines (workstation, laptop,
remote dev box). The JSONL on any one machine only shows that
machine's portion. The server-side quota is the only source of truth
for total usage, which is exactly why the settings page exists.

Related

Alternative Solutions

No response

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

No response

Additional Context

No response

extent analysis

TL;DR

Exposing the usage data via a supported endpoint or a claude subcommand would provide a reliable way for users to access their session and weekly usage programmatically.

Guidance

  • The proposed solution of adding a claude usage --json subcommand or a documented endpoint with user-scoped token authentication seems to address the gap between official support and usability for individual subscribers.
  • Verifying the feasibility of implementing such a solution would involve checking the existing API infrastructure and authentication mechanisms.
  • To mitigate the current issue, users could continue using the undocumented GET /api/organizations/{org_id}/usage endpoint with a scraped session cookie, but this approach is brittle and against the spirit of the ToS.
  • Exploring the Admin API (Usage and Cost API, Claude Code Analytics API) might provide insights, although it requires an Organization Admin API key, which is not available to individual Pro/Max subscribers.

Example

No code example is provided as the issue focuses on the need for a new feature rather than a specific code implementation.

Notes

The solution's implementation details, such as the exact endpoint or subcommand syntax, are not specified in the issue. The primary goal is to provide a supported and reliable way for users to access their usage data programmatically.

Recommendation

Apply a workaround by using the proposed claude usage --json subcommand or a documented endpoint, as it would provide a reliable and supported way for users to access their usage data. This approach addresses the critical need for a programmatic way to retrieve usage information without relying on undocumented endpoints or scraping session cookies.

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

claude-code - 💡(How to fix) Fix [FEATURE] Expose subscription usage (Pro/Max) via a documented API or CLI command [3 comments, 3 participants]