iToverDose/Software· 11 MAY 2026 · 16:01

Claude Code’s Token Usage Made Visible with Tortoise-Hare Status Bar

A developer’s playful yet practical status bar now tracks both weekly and five-hour token limits in Claude Code, helping users avoid sudden usage spikes with real-time visual cues.

DEV Community2 min read0 Comments

Claude Code’s recent rate limit adjustments have shifted focus from hourly bursts to sustained weekly usage. To keep pace, a clever status line now visualizes both the five-hour and seven-day windows side by side, blending urgency with clarity.

Why a Dual-Limit Status Bar Matters

Anthropic’s latest policy changes mean the five-hour cap is easier to manage while the seven-day ceiling remains the real challenge. For heavy users, this creates a paradox: short sessions feel unrestricted, but over several days, the cumulative cost adds up. A developer known as Suru Seas addressed this by crafting a status line that treats the seven-day window as the primary concern and the five-hour window as a secondary check. The result is a single-line snapshot that reveals whether your spending is steady like a tortoise or racing ahead like a hare.

The design uses two horizontal bars—one long for the week, one half-length for the five-hour period—each marked with emoji indicators. Over 100% triggers a warning, flagging when you’ve dipped into Claude Code’s buffer usage beyond the standard limits.

How the Status Bar Works Behind the Scenes

The script pulls data from Claude’s API response, including model name, percentage of limits consumed, and reset times. It then calculates ideal progress bars for both windows and overlays the actual usage. Here’s the core logic in action:

#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
FIVE_H_PCT=$(echo "$input" | jq -r '(.rate_limits.five_hour.used_percentage // 0)')
SEVEN_D_PCT=$(echo "$input" | jq -r '(.rate_limits.seven_day.used_percentage // 0)')

The script uses simple math to determine how full each bar should appear. For the seven-day window, it divides the remaining seconds by the total week length (604,800 seconds) and scales the bar width (20 characters) accordingly. The five-hour window uses the same approach but with a 10-character bar and a 18,000-second total.

W7=20
W5=10
make_bar() {
  local actual=$1
  local ideal=$2
  local width=$3
  local bar=""
  for i in $(seq 0 $((width - 1))); do
    if [ "$i" -eq "$ideal" ] && [ "$i" -eq "$actual" ]; then
      bar="${bar}🐢🐇"
    elif [ "$i" -eq "$ideal" ]; then
      bar="${bar}🐢"
    elif [ "$i" -eq "$actual" ]; then
      bar="${bar}🐇"
    else
      bar="${bar}·"
    fi
  done
  [ "$actual" -ge "$width" ] && bar="${bar}🐇"
  echo "$bar"
}

Warnings appear when actual usage exceeds the ideal pace, and reset timestamps are displayed in local time to keep users informed.

Customizing for Your Workflow

The script is lightweight and designed for flexibility. Adjust TZ=Asia/Tokyo at the top to match your local timezone, ensuring reset times display correctly. The bar widths (W7=20, W5=10) can be tweaked to fit smaller interfaces, and the logic can be extended to support other rate-limited APIs.

For developers juggling multiple tools with varying reset cycles, this approach offers a template for visualizing usage across services. Whether you’re prototyping or running production workloads, clear visibility into limits prevents unexpected lockouts and budget surprises.

Looking ahead, as AI tools evolve their pricing models, status indicators like this one could become a standard way to balance cost and productivity without constant manual checks.

AI summary

Claude Code’un token ve saatlik kullanım limitlerini görsel olarak takip eden basit bir terminal betiği. Haftalık ve beş saatlik pencereyi aynı ekranda gösterir. Kullanım oranlarınızı anında izleyin.

Comments

00
LEAVE A COMMENT
ID #7IU0TK

0 / 1200 CHARACTERS

Human check

8 + 2 = ?

Will appear after editor review

Moderation · Spam protection active

No approved comments yet. Be first.