Claude Code statusline generator
By Claude Resets · Updated
Claude Code can print a custom statusline under the prompt, and it receives your live 5-hour and weekly usage. Tick what you want below and copy two snippets; your statusline then shows usage and a reset countdown all the time, so a limit never catches you by surprise.
Show in my status line
Statusline preview (sample data)
1. Paste into your terminal to install the statusline
Creates ~/.claude/statusline.sh and makes it executable.
mkdir -p ~/.claude && cat > ~/.claude/statusline.sh <<'CLAUDE_RESETS_EOF'
#!/bin/bash
# Claude Code status line: generated at https://claude-resets.net/claude-code-statusline
# Needs jq. Rate limit fields only exist for claude.ai Pro/Max, after the first reply.
input=$(cat)
now=$(date +%s)
get() { echo "$input" | jq -r "$1 // empty"; }
left() {
local s=$(( ${1%.*} - now )); [ "$s" -lt 0 ] && s=0
if [ "$s" -ge 86400 ]; then printf '%dd%dh' $((s/86400)) $((s%86400/3600))
else printf '%dh%02dm' $((s/3600)) $((s%3600/60)); fi
}
paint() {
local p=${1%.*}
if [ "$p" -ge 80 ]; then printf '\033[31m%s\033[0m' "$2"
elif [ "$p" -ge 50 ]; then printf '\033[33m%s\033[0m' "$2"
else printf '\033[32m%s\033[0m' "$2"; fi
}
parts=()
m=$(get .model.display_name); [ -n "$m" ] && parts+=("[$m]")
p=$(get .rate_limits.five_hour.used_percentage); r=$(get .rate_limits.five_hour.resets_at)
if [ -n "$p" ]; then
seg="5h $(printf "%.0f" "$p")%"
[ -n "$r" ] && seg="$seg ↻$(left "$r")"
parts+=("$(paint "$p" "$seg")")
fi
p=$(get .rate_limits.seven_day.used_percentage); r=$(get .rate_limits.seven_day.resets_at)
if [ -n "$p" ]; then
seg="7d $(printf "%.0f" "$p")%"
[ -n "$r" ] && seg="$seg ↻$(left "$r")"
parts+=("$(paint "$p" "$seg")")
fi
out=""; for x in "${parts[@]}"; do out="${out:+$out | }$x"; done
printf '%s\n' "$out"
CLAUDE_RESETS_EOF
chmod +x ~/.claude/statusline.sh2. Turn the statusline on in ~/.claude/settings.json
Merge the statusLine block into the existing file, then restart Claude Code.
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"refreshInterval": 30
}
}View the statusline script
#!/bin/bash
# Claude Code status line: generated at https://claude-resets.net/claude-code-statusline
# Needs jq. Rate limit fields only exist for claude.ai Pro/Max, after the first reply.
input=$(cat)
now=$(date +%s)
get() { echo "$input" | jq -r "$1 // empty"; }
left() {
local s=$(( ${1%.*} - now )); [ "$s" -lt 0 ] && s=0
if [ "$s" -ge 86400 ]; then printf '%dd%dh' $((s/86400)) $((s%86400/3600))
else printf '%dh%02dm' $((s/3600)) $((s%3600/60)); fi
}
paint() {
local p=${1%.*}
if [ "$p" -ge 80 ]; then printf '\033[31m%s\033[0m' "$2"
elif [ "$p" -ge 50 ]; then printf '\033[33m%s\033[0m' "$2"
else printf '\033[32m%s\033[0m' "$2"; fi
}
parts=()
m=$(get .model.display_name); [ -n "$m" ] && parts+=("[$m]")
p=$(get .rate_limits.five_hour.used_percentage); r=$(get .rate_limits.five_hour.resets_at)
if [ -n "$p" ]; then
seg="5h $(printf "%.0f" "$p")%"
[ -n "$r" ] && seg="$seg ↻$(left "$r")"
parts+=("$(paint "$p" "$seg")")
fi
p=$(get .rate_limits.seven_day.used_percentage); r=$(get .rate_limits.seven_day.resets_at)
if [ -n "$p" ]; then
seg="7d $(printf "%.0f" "$p")%"
[ -n "$r" ] && seg="$seg ↻$(left "$r")"
parts+=("$(paint "$p" "$seg")")
fi
out=""; for x in "${parts[@]}"; do out="${out:+$out | }$x"; done
printf '%s\n' "$out"
Needs bash and jq (macOS: brew install jq). The 5-hour and weekly numbers only appear for claude.ai Pro and Max, after the first reply in a session.
What this Claude Code statusline shows
The generated statusline reads the JSON that Claude Code sends to your script. For claude.ai Pro and Max subscribers that includes rate_limits.five_hour and rate_limits.seven_day, each with used_percentage and resets_at. The statusline script turns those into “5h 62% ↻1h48m” and “7d 34% ↻3d5h”, and colours each part green, yellow or red.
Why is part of my status line empty?
The rate limit fields only appear for Pro and Max, and only after the first reply in a session. On API billing the statusline simply shows the other parts; the script handles missing fields.
Install the statusline in two steps
The two statusline snippets above do everything:
- 01Paste the first snippet into a terminal. It writes ~/.claude/statusline.sh and makes it executable.
- 02Add the statusLine block to ~/.claude/settings.json (merge it if the file already has settings) and restart Claude Code.
- 03The statusline script needs jq. On macOS run brew install jq; on Windows use WSL or Git Bash.
Why refreshInterval is set
A statusline normally redraws only when something happens in the session. With a countdown on screen, the statusline generator adds refreshInterval: 30 so the numbers keep moving while you read.
Change or remove the statusline
To change your statusline, run the generator again and paste the new first snippet: it overwrites the old statusline script. To remove the statusline, delete the statusLine block from settings.json, or run /statusline delete inside Claude Code. The statusline runs locally and does not use any tokens.
Pair it with reset alerts
A statusline tells you how much is left. It cannot tell you when Anthropic will refill everyone early. For that, watch our reset odds and the Claude reset time calculator.
FAQ
Does the statusline cost tokens?
+
No. The statusline script runs on your machine and only reads data Claude Code already has.
Can I use /statusline instead?
+
Yes. /statusline asks Claude to write a statusline script from a description. This generator gives you a tested script in seconds without spending a turn.
Where do the numbers in my status line come from?
+
From the rate_limits fields Claude Code passes to the script, the same numbers you see in Settings → Usage.