Expose /usage data in statusLine JSON API
Feature Request
The statusLine command type receives a JSON payload on stdin with session-level metrics (cost.total_cost_usd, context_window.*, etc.), which is great for session tracking.
However, the /usage command shows additional account-level information that would be very useful in the status line but isn't currently available in the JSON payload:
Missing fields
- Weekly/monthly usage totals - cumulative cost and token usage across sessions for the current billing period
- Plan limits - remaining quota or usage cap information
- Cache token breakdown -
cache_creation_input_tokensandcache_read_input_tokensare available undercontext_window.current_usagebut only for the last API call, not as cumulative session totals
Use case
Users who want to monitor their usage budget in real-time via the status line currently have no way to see weekly/monthly totals without running /usage manually. A workaround of logging session costs to a file is inaccurate since it can't account for sessions not tracked (e.g. different machines, API usage outside CLI).
Proposed additions to the statusLine JSON
{
"usage": {
"weekly_cost_usd": 12.34,
"monthly_cost_usd": 45.67,
"plan_limit_usd": 100.00,
"remaining_usd": 54.33
},
"cost": {
"total_cache_creation_tokens": 50000,
"total_cache_read_tokens": 120000
}
}
This would allow status line scripts to show a complete usage picture matching what /usage already exposes, without needing workarounds.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗