claude-code - 💡(How to fix) Fix [FEATURE] [Feature Request] Expose usage data via CLI (e.g. claude usage --json) for Stop hook integration

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…
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

Title: Expose usage data via CLI for Stop hook integration Request: Please expose Claude Code usage data through a CLI command (e.g. claude usage --json) so it can be consumed programmatically by Stop hooks and other scripts. Use case: I'd like my Stop hook to print a usage footer after each completed task, showing something like: 4% used - resets in 1 hr 30 min 9% used - resets Sat 10pm Today this isn't possible cleanly. The status line works for always-visible display, but it's CLI-only (not available in the desktop app), and the underlying 5-hour / 7-day usage data only seems accessible via the undocumented /api/oauth/usage endpoint, which community scripts rely on but isn't a stable contract.

Proposed Solution

What would help: A first-class claude usage --json command (or equivalent) that returns the same data shown by /usage, including:

5-hour utilization % and reset timestamp 7-day utilization % and reset timestamp Optionally: current session token counts

This would make it trivial to wire into a Stop hook so users get an after-task usage summary without scraping internal endpoints. It would also be useful for the desktop app users who don't have access to status lines. Thanks for considering.

Alternative Solutions

No response

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

No response

Additional Context

No response

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