◉CLAUDE LABJP
●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…
Articles/Claude Code
⟐ Claude Code/2026-03-27Intermediate

Claude Code Statusline — Displaying Rate Limits and Building Custom Scripts

Learn how to customize Claude Code's statusline to display real-time rate_limits usage. Covers settings.json configuration, custom script creation, and community tools for monitoring your usage.

Claude Code264statuslinerate limits7customization4configuration10

Visualize Your Usage with Claude Code's Statusline

When working in Claude Code for extended sessions, one question inevitably comes up: "How much of my rate limit have I used?" For Pro and Max plan subscribers, Claude enforces rolling 5-hour and 7-day usage windows, and hitting those limits mid-task can be frustrating.

Since Claude Code v2.1.80, the statusline feature now exposes a rate_limits field, letting you monitor your usage percentage and reset times in real time. This guide walks you through setting up the statusline, building custom scripts, and leveraging community tools to stay on top of your usage.

For a broader look at all Claude Code settings, check out our Claude Code settings.json Complete Guide.

What Is the Statusline?

The statusline is an information bar displayed at the bottom of your Claude Code terminal interface. By default, it shows the active model and token counts, but you can extend it with custom commands to display virtually anything.

Common information you can show includes:

  • Model name: The currently active model (Sonnet 4.6, Opus 4.6, etc.)
  • Token usage: Input/output token counts for the current session
  • rate_limits: 5-hour and 7-day window usage percentages and reset times
  • Git info: Current branch name and repository status
  • Custom data: Anything your script outputs

Basic Setup: Adding a Statusline to settings.json

Configure the statusline in your user settings at ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "echo 'Hello from statusline'"
  }
}

Adding this simple configuration causes Claude Code to run your command and display its output in the status bar.

Settings File Locations

ScopePathPurpose
User settings~/.claude/settings.jsonPersonal customization
Project settings.claude/settings.jsonProject-specific config
Enterprise~/.claude/settings.d/*.jsonOrganization policy distribution

The statusline is typically configured at the user level.

Working with the rate_limits Field

Starting with v2.1.80, Claude Code passes a rate_limits object to your statusline script via standard input as JSON. Here's the structure:

{
  "rate_limits": {
    "five_hour": {
      "used_percentage": 42.5,
      "resets_at": 1711540800
    },
    "seven_day": {
      "used_percentage": 15.3,
      "resets_at": 1712059200
    }
  }
}

Field Reference

  • five_hour.used_percentage: Usage within the 5-hour rolling window (0–100)
  • five_hour.resets_at: Reset timestamp (Unix epoch seconds)
  • seven_day.used_percentage: Usage within the 7-day window (0–100)
  • seven_day.resets_at: Reset timestamp (Unix epoch seconds)

This field is only available for Claude.ai subscribers (Pro/Max) and appears after the first API response in a session. It won't show up when using API keys directly.

Building Custom Statusline Scripts

Simple Bash Script

Let's start with a straightforward Bash script that displays rate limit information:

#!/bin/bash
# ~/.claude/statusline.sh
# Custom statusline script for Claude Code
 
# Read JSON data from stdin
INPUT=$(cat)
 
# Extract rate_limits with jq
FIVE_HOUR=$(echo "$INPUT" | jq -r '.rate_limits.five_hour.used_percentage // "N/A"')
SEVEN_DAY=$(echo "$INPUT" | jq -r '.rate_limits.seven_day.used_percentage // "N/A"')
MODEL=$(echo "$INPUT" | jq -r '.model // "unknown"')
 
# Convert reset time to human-readable format
RESETS_AT=$(echo "$INPUT" | jq -r '.rate_limits.five_hour.resets_at // 0')
if [ "$RESETS_AT" != "0" ] && [ "$RESETS_AT" != "null" ]; then
  RESET_TIME=$(date -d "@$RESETS_AT" '+%H:%M' 2>/dev/null || date -r "$RESETS_AT" '+%H:%M' 2>/dev/null)
else
  RESET_TIME="--:--"
fi
 
# Output the formatted statusline
echo "${MODEL} | 5h: ${FIVE_HOUR}% | 7d: ${SEVEN_DAY}% | Reset: ${RESET_TIME}"

Make it executable and register it in your settings:

chmod +x ~/.claude/statusline.sh
{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh"
  }
}

Node.js for a Richer Display

For more sophisticated formatting, a Node.js script gives you greater flexibility:

#!/usr/bin/env node
// ~/.claude/statusline.mjs
// Statusline with progress bars
 
import { createInterface } from 'readline';
 
const rl = createInterface({ input: process.stdin });
let data = '';
 
rl.on('line', (line) => { data += line; });
rl.on('close', () => {
  try {
    const info = JSON.parse(data);
    const parts = [];
 
    // Shortened model name
    const model = info.model || 'unknown';
    const shortModel = model.replace('claude-', '').replace('-4-6', '4.6');
    parts.push(shortModel);
 
    // Rate limits with progress bars
    if (info.rate_limits) {
      const fiveHour = info.rate_limits.five_hour;
      const sevenDay = info.rate_limits.seven_day;
 
      if (fiveHour) {
        const bar = makeBar(fiveHour.used_percentage);
        parts.push(`5h ${bar} ${fiveHour.used_percentage.toFixed(0)}%`);
      }
      if (sevenDay) {
        const bar = makeBar(sevenDay.used_percentage);
        parts.push(`7d ${bar} ${sevenDay.used_percentage.toFixed(0)}%`);
      }
    }
 
    // Token usage
    if (info.tokens) {
      const total = info.tokens.input + info.tokens.output;
      parts.push(`${(total / 1000).toFixed(1)}k tok`);
    }
 
    console.log(parts.join(' | '));
  } catch {
    console.log('statusline error');
  }
});
 
function makeBar(percentage) {
  const filled = Math.round(percentage / 10);
  const empty = 10 - filled;
  return '[' + '='.repeat(filled) + '-'.repeat(empty) + ']';
}

Expected output looks like this:

sonnet4.6 | 5h [====------] 42% | 7d [==--------] 15% | 12.3k tok

Quick Inline Configuration

If you prefer not to create a separate script file, you can use an inline command directly in settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "jq -r '\"\\(.model // \"?\") | 5h: \\(.rate_limits.five_hour.used_percentage // 0 | round)% | 7d: \\(.rate_limits.seven_day.used_percentage // 0 | round)%\"'"
  }
}

This is great for quick experimentation, though external scripts are better suited for complex logic.

Community Tools Worth Exploring

The Claude Code community has built several polished statusline tools:

claude-powerline

Inspired by Vim's Powerline, this tool offers themed, color-coded statusline displays with rich customization options.

# Install
npm install -g claude-powerline
 
# Register in settings.json
# "command": "claude-powerline"

ccusage

A usage analytics and visualization tool that includes statusline integration for tracking your Claude Code consumption over time.

# Install
npm install -g ccusage
 
# See https://ccusage.com/guide/statusline for statusline setup

ClaudeCodeStatusLine (Rust)

A performant Rust-based tool by Daniel Barreto that displays model, tokens, rate_limits, and git information in real time.

# Install via cargo
cargo install --git https://github.com/daniel3303/ClaudeCodeStatusLine

For general strategies on managing rate limits, see our Rate Limits Best Practices guide.

What to Do When Approaching Rate Limits

When your statusline shows usage climbing, here are practical strategies to stay productive:

1. Switch Models

Switching from Opus 4.6 to Sonnet 4.6 reduces rate limit consumption. Most coding tasks work perfectly well with Sonnet.

# Switch model mid-session
/model sonnet

2. Adjust Effort Levels

Use the --effort flag to control response depth. For simple queries, lower effort means fewer tokens consumed.

claude --effort low "What's the return type of this function?"

3. Split Long Sessions

Extended sessions accumulate context, increasing token consumption per request. Starting fresh sessions periodically helps manage your rate limit budget more effectively.

For deeper optimization techniques, see Mastering Claude Code's Effort Settings.

Looking back

Claude Code's statusline is a small configuration change that delivers a significant improvement to your development workflow. Real-time rate_limits visibility helps you plan your work sessions, avoid unexpected interruptions, and make informed decisions about model selection and effort levels.

Start with a simple inline command, graduate to a Bash or Node.js script as your needs grow, and explore community tools when you want a polished, ready-made solution. The key is making your usage data visible so you can code with confidence.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⟐ Claude Code2026-09-11
inferenceGatewayHeaders still works today. At noon on October 7 it falls back to a default
I read the deprecation notice that started appearing on September 10 as a spelling cleanup. After the cut-off, the old names are not ignored — they fall back to a fail-closed value or a default. Here is the old-to-new map and a script that audits your config in one pass.
⟐ Claude Code2026-08-31
The Same Announcement Reads as '+25%' and as 'a 17% Cut' — Checking the Math on Claude Code's September 14 Weekly Limit Change
From September 14, Claude Code's weekly limit becomes a permanent +25% over the pre-promo baseline. Here is why +25% and a 17% cut are the same change, and how to check your own exposure with /usage and a status line script.
⟐ Claude Code2026-08-25
A One-Letter Typo in settings.json Is Ignored Without a Single Warning
I diffed claude doctor output between a settings.json with misspelled keys and a correct one. There was no difference at all. Here is what actually gets validated, what slips through, and a small check that catches typos before they cost you a day.