Guide · Claude Code
Your usage limits, in the Claude Code status line
Claude Code already sends your five-hour and weekly usage to the status line. A few lines of jq put it on screen.
Last checked October 9, 2026. Limits change; the sources linked below are the final word.

The short version
Yes, Claude Code can show your usage limits in its status line. On a Pro or Max plan, it passes your five-hour and weekly usage percentages and reset times to any status line script as JSON. A short jq script turns that into something like Opus · 5h 42% · wk 61% · resets 15:45. It takes about five minutes, and you don’t need another app.
What Claude Code gives your script
The status line runs a command you choose and sends session data to it on stdin. For claude.ai subscribers, that data includes a rate_limits object:
rate_limits.five_hour.used_percentageandrate_limits.seven_day.used_percentage: 0 to 100.rate_limits.five_hour.resets_atandrate_limits.seven_day.resets_at: Unix epoch seconds.
Some caveats from the docs: rate_limits appears only for Pro and Max subscribers (or behind a Claude apps gateway with spend limits), and only after the first API response in a session. Each window can be missing on its own, and Claude Code drops a window once its reset time passes. Your script has to handle missing fields, which is what // empty does below.
Do it yourself
1. Save the script as ~/.claude/statusline.sh. It needs jq (brew install jq).
#!/bin/bash
# ~/.claude/statusline.sh: model, 5-hour and weekly usage, next reset
input=$(cat)
model=$(echo "$input" | jq -r '.model.display_name')
five=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
week=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
reset=$(echo "$input" | jq -r '.rate_limits.five_hour.resets_at // empty')
out="$model"
[ -n "$five" ] && out="$out · 5h $(printf '%.0f' "$five")%"
[ -n "$week" ] && out="$out · wk $(printf '%.0f' "$week")%"
[ -n "$reset" ] && out="$out · resets $(date -r "$reset" +%H:%M)"
echo "$out"date -r is the macOS form. On Linux, use date -d @"$reset" +%H:%M.
2. Make it executable: chmod +x ~/.claude/statusline.sh
3. Point Claude Code at it in ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh"
}
}The script runs when a session starts, after each new assistant message, and when a rate-limit window it last saw reaches its reset time. Updates are debounced by 300 ms. Add "refreshInterval": 60 if you also want it re-run every minute while the session is idle. Prefer not to write it by hand? Run /statusline and describe what you want.
This is the approach in Anthropic’s own status line docs, which include Bash, Python and Node versions. If you only need Claude’s numbers in one terminal, this is all you need.
Variation: color by how full each window is
The status line supports ANSI colors (your terminal has to as well), and each line your script prints becomes a row. This version colors each window green, yellow or red and adds the weekly reset day, which matters more than the time once you’re near the weekly limit:
#!/bin/bash
# ~/.claude/statusline.sh: 5-hour and weekly usage, colored by how full they are
input=$(cat)
color() { # green under 50, yellow under 80, red from 80
p=${1%.*}
if [ "$p" -ge 80 ]; then printf '\033[31m'; elif [ "$p" -ge 50 ]; then printf '\033[33m'; else printf '\033[32m'; fi
}
five=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
week=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')
wreset=$(echo "$input" | jq -r '.rate_limits.seven_day.resets_at // empty')
out=""
[ -n "$five" ] && out="$out$(color "$five")5h $(printf '%.0f' "$five")%\033[0m "
[ -n "$week" ] && out="$out$(color "$week")wk $(printf '%.0f' "$week")%\033[0m"
[ -n "$wreset" ] && out="$out · week resets $(date -r "$wreset" '+%a %H:%M')"
printf '%b\n' "$out"The thresholds are ours; pick your own. Anthropic’s docs note that complex escape sequences can occasionally garble output and suggest plain text if that happens. date -r with a format is the macOS form; on Linux use date -d @"$wreset" '+%a %H:%M'.
Other fields worth adding
context_window.used_percentage: how full this conversation is. It’s calculated from input tokens only and can benullearly in a session.cost.total_cost_usd: an estimated session cost at list price. On a subscription it isn’t your bill.prompt_cache: hit ratio and whether the cache is warm (v2.1.251+), useful if usage climbs after breaks.
And Codex?
Codex has its own status line. Run /statusline in the Codex CLI and turn on the rate-limits item. The two tools don’t share one line, though, so with plain DIY scripts each terminal shows only its own tool.
The one-switch option: Quotchi
Quotchi, our Mac menu bar app, has an opt-in, Free status line integration under Settings → AI tools → Claude. Here’s what it does differently from the DIY script:
- Previews the change first and shows the exact before and after of your
statusLineentry. Nothing is written until you confirm. - Backs up
settings.jsonand changes only thestatusLinevalue. Everything else stays byte-for-byte. - Chains your existing status line. Your current command still runs, and Quotchi appends a segment such as
Claude 5h 42% · wk 61% · Codex 30%. - Adds Codex to the same line, from the reading in the menu bar. A Codex reading older than five minutes shows as stale instead of an old number.
- Removes cleanly. Turning it off restores your previous status line exactly.
It won’t touch a file it can’t parse safely, and it explains when your organization’s managed settings control the status line. If you’re happy with the script above, keep it. Quotchi is for when you also want Codex, menu bar alerts and reset times without opening a terminal.
Quotchi shows Claude Code and Codex usage, reset times and gentle alerts in the Mac menu bar, and in your status line if you want. It’s Free and local-first.
See how Quotchi worksTroubleshooting
Status line problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing shows | Script not executable, or writes to stderr | chmod +x; print to stdout; run the script by hand |
| Blank in a new folder | Workspace trust not accepted | Restart and accept the trust dialog; claude --debug logs Status line command skipped |
| Rate-limit segment empty | Not a Pro/Max subscriber, or no API response yet this session | Send a message; check you’re signed in with your plan, not an API key |
| One window missing | Its reset time passed | It returns after the next response |
-- or empty values | Fields can be null before the first response | Use fallbacks like // empty or // 0 |
| Your status line vanished at work | allowManagedHooksOnly or disableAllHooks in settings | Ask your administrator |
Test it without Claude Code
Pipe a sample payload into the script to check the output before wiring it up:
echo '{"model":{"display_name":"Opus"},"rate_limits":{"five_hour":{"used_percentage":42,"resets_at":1791900000},"seven_day":{"used_percentage":61,"resets_at":1792200000}}}' | ~/.claude/statusline.shIf that prints what you expect but Claude Code shows nothing, it’s a configuration or trust issue, not the script.
Common mistakes and myths
“The status line polls Anthropic for my usage.”
Your script doesn’t fetch anything. Claude Code passes the latest data to your script on stdin when events happen, or on your refreshInterval.
“It works with an API key too.”
rate_limits appears for claude.ai Pro and Max subscribers (or behind a Claude apps gateway with spend limits). API-key sessions have no plan windows to show.
“Context percentage is my usage limit.”
It’s how full this conversation is. Your plan usage is in rate_limits.
“A status line replaces /usage.”
It shows the two percentages and reset times. /usage also explains what used the allowance.
What changed recently
As of October 9, 2026, Anthropic’s status line docs list prompt_cache fields (v2.1.251+), rate_limits.spend_limit for Claude apps gateway users (v2.1.251+, dollar fields v2.1.284+), and a refreshInterval option for timer-based updates. Claude Code also re-runs the script when a rate-limit window reaches its reset time.
Sources
Official pages we read on October 9, 2026. If anything here disagrees with them, they win.
FAQ
Can Claude Code show my usage limit in the status line?
Yes. For Pro and Max subscribers, Claude Code passes rate_limits.five_hour and rate_limits.seven_day, each with used_percentage and resets_at, to your status line command on stdin.
Why is my rate limit segment empty?
The rate_limits object only appears for claude.ai Pro and Max subscribers, and only after the first API response in a session. A window is also dropped once its reset time passes.
Do I need a third-party tool?
No. A short shell script using jq, as in Anthropic’s status line docs, is enough to show the five-hour and weekly percentages.
How often does the status line update?
It runs at session start, after each new assistant message, on a few other events, and when a rate-limit window reaches its reset time. An optional refreshInterval re-runs it every N seconds.
Can the status line use colors or several lines?
Yes. Anthropic’s docs say each line your script prints is a row, and ANSI escape codes work if your terminal supports them.
Why is the status line blank in a new project?
Claude Code doesn’t run the status line command until you accept the workspace trust dialog for that folder.
Can I test my script without Claude Code?
Yes. Pipe a sample JSON payload into it with echo '…' | ~/.claude/statusline.sh and check the output.
