Skip to content

tyrelh/claude-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

claude-usage

Screenshot of a small terminal window showing two green bars less than 20% full, first represents the 5-hour window usage and the second represents the 7-day window usage of your Claude plan

Terminal monitor for Claude Code usage limits. Polls the Anthropic OAuth usage endpoint and renders progress bars for 5-hour, 7-day, and (if applicable) extra-credit windows.

Requirements

  • macOS (reads OAuth token from the Claude Code-credentials keychain entry)
  • claude CLI installed and logged in
  • jq, curl, security

Usage

./claude-usage.sh [--full] [--interval=SECONDS] [--width=N|auto]

Flags

Flag Default Description
--full off Print raw JSON response instead of bars
--interval=N 600 Seconds between refreshes
--width=N auto Bar width in chars; auto fits the terminal

Example

./claude-usage.sh --interval=120

Behavior

  • Auto-refreshes the OAuth token via claude -p when within 60s of expiry.
  • Clears the screen each tick when stdout is a TTY.
  • Bar color: green ≤50%, yellow ≤75%, red >75%.
  • On HTTP 429 or non-200, prints the error and keeps looping.

Notes

I've found the Claude API will rate-limit you at an interval of 5 mins (300 seconds). 10 mins (600 seconds) seems to be a fine default that I haven't seen rate-limit errors at.

About

Simple bash script that shows current Claude plan usage in a simple visual

Resources

Stars

Watchers

Forks

Contributors

Languages