Minimal two-line statusline for Claude Code showing model, project, git branch, API usage, and context window.
Claude Opus 4.6 | my-project • main
5h 16% (2h 43m) • 7d 20% (6d 9h) | ctx 12% (11k/200k)
Based on this Reddit post by u/xleddyl — adapted to work cross-platform (macOS + Linux/WSL).
| Element | Description |
|---|---|
| Model | Current Claude model (orange) |
| Folder | Project directory name (cyan) |
| Branch | Git branch or short SHA (purple) |
| 5h / 7d | API usage percentage with time until reset |
| ctx | Context window usage % and token count |
curl -sL https://gist.githubusercontent.com/RAW_URL/fetch-usage.sh -o ~/.claude/fetch-usage.sh
curl -sL https://gist.githubusercontent.com/RAW_URL/statusline-command.sh -o ~/.claude/statusline-command.sh
chmod +x ~/.claude/fetch-usage.sh ~/.claude/statusline-command.shOr just copy the two .sh files into ~/.claude/.
Add this to ~/.claude/settings.json (merge with existing config if you have one):
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline-command.sh"
},
"hooks": {
"PreToolUse": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/fetch-usage.sh > /dev/null 2>&1 &"
}
]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/fetch-usage.sh > /dev/null 2>&1 &"
}
]
}
]
}
}The statusline appears on the next session. Usage stats populate after the first tool use.
curlandjq(both widely available)git(for branch display)
- Hooks run
fetch-usage.shin the background on every tool use and when Claude stops fetch-usage.shreads your OAuth token and calls the Anthropic usage API, caching results to/tmp/.claude_usage_cache- The statusline command reads the cache (instant) plus stdin JSON from Claude Code to render the display
Token retrieval is platform-aware:
- macOS — reads from Keychain via
security find-generic-password - Linux/WSL — reads from
~/.claude/.credentials.json
- No usage stats — run
bash ~/.claude/fetch-usage.shmanually, then checkcat /tmp/.claude_usage_cache - Token not found — on Linux, verify
~/.claude/.credentials.jsonexists; on macOS, check Keychain access - Stale data — delete
/tmp/.claude_usage_cache; it refreshes on next tool use