Surfacing Claude Code's rate limit data

Claude Code warns you when you’re about to hit your Anthropic rate limit, but it doesn’t show your current usage percentage or time until reset. The data is already there, just not exposed.

The rate limit data

Every messages.create call to the Anthropic API returns these headers:

anthropic-ratelimit-unified-5h-utilization
anthropic-ratelimit-unified-5h-reset
anthropic-ratelimit-unified-7d-utilization
anthropic-ratelimit-unified-7d-reset

Claude Code parses them and keeps them in memory. On startup it sends a 1-token API call ("quota") to fetch initial values. It only uses this state to trigger warnings near 100%.

Hooking into the status line

The CLI has a statusLine config that pipes a JSON object to a shell command via stdin on every render. On Pro/Max plans, this JSON includes a rate_limits field with your 5-hour and 7-day usage percentages and reset times.

I wrote a bash script that parses this JSON and formats it:

[████████░░] 76%  2h:75%  45h:55%  Opus 4.6 (1M)  main

Context window, 5h usage with time until reset (color-coded), 7d usage, model, git branch.

Setup

Requirements: jq and a Pro or Max subscription.

cp statusline-command.sh ~/.claude/statusline-command.sh
chmod +x ~/.claude/statusline-command.sh

Add to ~/.claude/settings.json:

{
  "statusLine": {
    "command": "bash ~/.claude/statusline-command.sh"
  }
}

Interactive builder: tzk.ar/claude-statusline

Repo: github.com/vfmatzkin/claude-statusline

Discussion on r/ClaudeCode.