[FEATURE] [Feature Request] Expose usage data via CLI (e.g. claude usage --json) for Stop hook integration

Resolved 💬 3 comments Opened May 8, 2026 by tandokheng Closed May 11, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] 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_

View original on GitHub ↗

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