StatusLine should expose API usage/quota information in JSON input
Issue Type: Feature Request / Enhancement
Description:
The Claude Code CLI internally tracks API usage limits and displays warnings like "Approaching usage limit •
resets at 7pm" in the terminal interface. However, this usage information is not exposed through the statusLine
JSON input, preventing users from displaying quota information in custom status lines.
Current Behavior:
- Claude Code tracks usage internally and shows warnings when limits are approached
- StatusLine scripts receive JSON input with workspace information but no usage data
- Users cannot display remaining quota or reset times in their custom status lines
Expected Behavior:
The JSON input passed to statusLine scripts should include usage information such as:
{
"workspace": { ... },
"usage": {
"requests_remaining": 150,
"total_requests": 1000,
"percentage_used": 85,
"reset_time": "2024-08-12T19:00:00Z",
"next_reset_human": "7pm"
}
}
Use Case:
I want to create a custom statusLine that displays:
- Remaining token/request quota
- Time until quota reset
- Current working directory
- Git branch name
Currently, I can display the directory and git info, but not the usage data that Claude Code clearly has access
to internally.
Current StatusLine Configuration:
# ~/.claude/statusline-command.sh shows:
Quota: N/A | Reset: N/A | [main] project-folder
Environment:
- Platform: macOS (Darwin 24.6.0)
- Claude Code version: [current version]
Additional Context:
Since Claude Code already tracks and displays this usage information in its own interface, exposing it through
the statusLine API would allow users to create more informative and useful custom status displays without
requiring separate API calls or workarounds.
13 Comments
You can use this in the meantime → https://github.com/TylerGallenbeck/claude-code-limit-tracker
Obviously won't be as accurate as native support, but should get you pretty close.
<img width="758" height="82" alt="Image" src="https://github.com/user-attachments/assets/470c001d-e9b8-4b82-a345-68d090f22fc3" />
Hey, this is a great feature request!
Just wanted to add a bit of context from the latest docs and changelog for anyone else following this issue.
It looks like the team added session cost tracking to the
statusLineinput in version1.0.85. According to the documentation (Status line configuration), the JSON input now includes acostobject:So you can get the current session's cost, which is a nice step forward. For example, in your
statusline-command.shyou could add something like this (if you havejqinstalled):---
That said, I think you're pointing out a good distinction between session cost (which is now available) and overall account usage/quota (which is what you're asking for). The session cost is probably tracked locally by the CLI, whereas getting the account-level quota information would likely require a separate network request to an Anthropic billing API on every status update, which they might be trying to avoid for performance reasons.
Still, having that
usageobject you mocked up would be fantastic for power users. It would be way more useful than just the session cost for understanding when you're about to hit a limit.+1 from me on this idea! Hope the team considers it.
Sweet - I didn't know some of these things existed
+1 for this feature!
I would love to have token usage percentage and rate limit reset time exposed in the statusline
JSON input.
Currently, Claude Code internally tracks this information (visible in system warnings like
Token usage: 28150/200000; 171850 remaining), but it's not accessible to custom statuslinescripts.
Proposed addition to JSON structure:
```json
{
"usage": {
"tokens_used": 28150,
"tokens_limit": 200000,
"tokens_remaining": 171850,
"percentage_used": 14.08,
"reset_at": "2025-10-15T00:00:00Z"
}
}
This would allow users to display real-time usage information in their custom statusline,
helping them better manage their API quota without interrupting their workflow.
+1 for this feature!
Being able to see weekly API usage limits and reset times in the status line would be
incredibly helpful for managing quota without interrupting workflow.
Current workaround of checking
/usagemanually isn't ideal when you're deep in a task. Havingthis exposed in the statusLine JSON (like the existing
costobject) would make resourcemanagement seamless.
Would love to see the
usageobject with:Thanks for tracking this!
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
+1. Would be awesome to have access to this in statusline.
+1
couldn't agree with you more
https://github.com/anthropics/claude-code/issues/5621#issuecomment-3401266021
without it, we don't know when to and how to manage shifting to another platform when we have critical tasks. Please provide visibility on this metric
+1 would love to had status line updated with quick and accurate information about API usage/Plan and reset timers rather than having to use a slash command
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.