Displays your Claude API 5-hour and 7-day usage limits live in the Claude Code
statusline — no more typing /usage, always visible while you code.
Example output:
⚡ 5h 20% | 7d 27%
Color coding: green below 50%, yellow 50–80%, red above 80%.
- Reads your OAuth token from
~/.claude/.credentials.json - Calls
https://api.anthropic.com/api/oauth/usage - Caches the result for 5 minutes
- Outputs a compact colored string to the Claude Code statusline
The statusline script is invoked automatically by Claude Code after each response — no background process, no daemon, zero overhead.
| Platform | Status |
|---|---|
| Windows (Git Bash) | ✅ Supported |
| macOS | 🔜 Planned |
| Linux | 🔜 Planned |
- Claude Code CLI (authenticated with a Claude.ai account)
- Python 3.8+
curl- Git Bash (Windows) or bash (macOS/Linux)
# Example: place the tool under ~/tools/claude-tools/
git clone https://github.com/YOUR_USERNAME/claude-tools ~/tools/claude-toolschmod +x ~/tools/claude-tools/usage-statusline/claude-usage.shAdd (or merge) the following block:
{
"statusLine": {
"type": "command",
"command": "/path/to/claude-tools/usage-statusline/claude-usage.sh",
"padding": 1
}
}Windows note: use the Git Bash path format, e.g.
/e/projects/claude-tools/usage-statusline/claude-usage.sh
Open a new Claude Code session — the statusline will appear immediately.
| Option | Default | Description |
|---|---|---|
| Cache TTL | 300 s | Edit CACHE_MAX_AGE in claude-usage.py |
| Color thresholds | 50% / 80% | Edit the color() function in claude-usage.py |
- macOS / Linux support
-
install.shscript that patchessettings.jsonautomatically - Token auto-refresh on expiry
- Optional opus usage line (
seven_day_opus)