[FEATURE] Expose enterprise spending limit data via /api/oauth/usage
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
I'm building a Claude Code statusline extension that displays real-time usage information. For subscription plans, the /api/oauth/usage endpoint provides five_hour and seven_day utilization data, which works great for showing usage limits with reset timers.
However, for enterprise plans, this endpoint returns no usage data at all. Enterprise users have per-user monthly spending limits visible in the Console UI (Settings > Usage), but there's no programmatic way to access this information. The statusline can only show rough session cost estimates, while subscription users get a much richer experience with actual limit tracking.
This makes it impossible to build tools that help enterprise users monitor their budget consumption in real time.
Proposed Solution
The /api/oauth/usage endpoint should return spending limit data for enterprise plans, similar to how it already returns five_hour/seven_day data for subscription plans:
{
"spending_limit": {
"limit_usd": 1000.00,
"used_usd": 133.49,
"utilization": 13.35,
"resets_at": "2025-05-01T00:00:00Z"
}
}
This keeps the response structure consistent — enterprise users get a spending_limit object, subscription users get five_hour/seven_day objects. Tools consuming this API can handle both plan types uniformly.
Alternative Solutions
- Console UI: Manually checking
Settings > Usagein the browser — not programmatic, breaks workflow. - Session cost estimation: Calculating approximate cost from token counts per model — inaccurate and doesn't reflect the actual spending limit or cumulative usage.
Priority
Nice to have — Enterprise users can still work without this, but it would significantly improve the developer experience and enable better tooling.
Feature Category
API / CLI behavior
Use Case Example
- An enterprise user starts a Claude Code session with a $1,000/month spending limit
- They've used $800 so far this month and want to be mindful of remaining budget
- Their statusline currently shows:
Opus 4.6 | v1.0.80 | main | 120k/1.0M | $2.35(only session cost) - With this feature, the statusline could show:
Opus 4.6 | v1.0.80 | main | 120k/1.0M | 80% (5d12h)— showing 80% of monthly limit used with reset timer, just like subscription plans show their 5h/7d limits - This helps users pace their usage and avoid hitting the limit unexpectedly
Additional Context
- The subscription plan response structure (
five_hour.utilization,five_hour.resets_at) is a great pattern to follow - The proposed
spending_limitobject mirrors the same shape for consistency - This would enable the community to build richer statusline extensions and monitoring tools for enterprise environments
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗