Skip to main content

Check your Claude plan usage limits from the terminal โ€” no more switching to the desktop app

Project description

๐ŸŽฏ claude-plan-usage

PyPI Version Python Version License: MIT PRs Welcome Zero Dependencies

Your Claude plan usage limits โ€” in the terminal. No more switching to the desktop app.

  Plan usage limits  Team

  Current session
  Resets in 4 hr 38 min
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”  13% used

  Weekly limits

  All models
  Resets in 130 hr 58 min
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”  4% used

  Last updated: 14:01:55  โ— within limits

๐Ÿ“‘ Table of Contents


โœจ Key Features

  • ๐ŸŽฏ Exact numbers โ€” reads the same data as claude.ai/settings/usage, not estimates
  • โšก Instant โ€” one command, results in 2 seconds
  • ๐Ÿ”Œ Claude Code integration โ€” add as a /usage slash command, never leave your session
  • ๐Ÿชถ Zero dependencies โ€” just Python standard library, nothing to install
  • ๐Ÿ”‘ Zero config โ€” auto-reads your auth from macOS Keychain
  • ๐Ÿ’ฐ Basically free โ€” each check costs ~$0.000001 (one Haiku token)
  • ๐Ÿ“Š Color-coded progress bars โ€” blue, yellow, red based on utilization

๐Ÿค” Why Not Other Tools?

Other usage trackers (like claude-monitor) parse your local session files and estimate your limits using token counts, ML predictions, and P90 calculations. They're guessing.

claude-plan-usage doesn't guess. It reads undocumented rate limit headers directly from Anthropic's API โ€” the exact same data source that powers the claude.ai/settings/usage page.

When the dashboard says 50%, this tool says 50%. Same number. Same source.

๐Ÿ”ฎ Other tools ๐ŸŽฏ claude-plan-usage
Data source Local session files โœ… Live API response headers
Accuracy Estimated from token counts โœ… Exact โ€” same as claude.ai dashboard
What it shows Token counts, burn rates, predictions โœ… Actual plan utilization % and reset times
Setup Config files, plan selection, themes โœ… pip install and done
Dependencies Heavy (ML, Rich, Pydantic, Sentry) โœ… Zero โ€” Python standard library only
Complexity 100+ files โœ… ~200 lines of code

๐Ÿ’ก The key discovery: Anthropic returns anthropic-ratelimit-unified-5h-utilization and anthropic-ratelimit-unified-7d-utilization headers on every API response. These are undocumented. Nobody was reading them. Now you can.


๐Ÿš€ Installation

pip install claude-plan-usage

That's it. No config. No setup. No API keys needed.


๐Ÿ“– Usage

Terminal

claude-plan-usage

๐Ÿ”Œ Inside Claude Code (Slash Command)

This is the cool part โ€” you can check your usage without leaving your Claude Code session.

Create this file at ~/.claude/skills/usage/SKILL.md:

---
name: usage
description: Show Claude plan usage limits (current session and weekly)
disable-model-invocation: true
allowed-tools: Bash
---

Run the following command and display the output to the user exactly as-is:

\```bash
claude-plan-usage
\```

Now just type /usage in any Claude Code session. โœจ

๐Ÿ Python API

from claude_usage import get_plan_limits

limits, error = get_plan_limits()
if limits:
    print(f"Session: {limits['session']['percent']}% used")
    print(f"Weekly:  {limits['weekly']['percent']}% used")
    print(f"Status:  {limits['status']}")

๐Ÿ” How It Works

Anthropic returns undocumented rate limit headers on every API response:

Header What it tells you
anthropic-ratelimit-unified-5h-utilization ๐Ÿ“Š Current session usage (0.0 to 1.0)
anthropic-ratelimit-unified-5h-reset โฐ When the session resets (unix timestamp)
anthropic-ratelimit-unified-7d-utilization ๐Ÿ“Š Weekly usage (0.0 to 1.0)
anthropic-ratelimit-unified-7d-reset โฐ When the week resets (unix timestamp)
anthropic-ratelimit-unified-status โœ… allowed or ๐Ÿšซ throttled

How it works under the hood:

  1. ๐Ÿ”‘ Reads your OAuth token from macOS Keychain (stored by Claude Code CLI on login)
  2. ๐Ÿ“ก Sends one tiny Haiku API call (1 token)
  3. ๐Ÿ“‹ Reads the rate limit headers from the response
  4. ๐ŸŽจ Renders progress bars with colors in your terminal

Zero config. Zero dependencies. Just works.


๐ŸŽจ Progress Bar Colors

Color Utilization Vibe
๐Ÿ”ต Blue 0โ€“49% You're chilling
๐ŸŸก Yellow 50โ€“79% Maybe slow down
๐Ÿ”ด Red 80โ€“100% You're about to hit the wall

๐Ÿ“‹ Requirements

Requirement Details
๐ŸŽ OS macOS (uses Keychain for auth)
๐Ÿค– Claude Code Installed and logged in
๐Ÿ Python 3.9+

๐Ÿง Linux/Windows users: PRs welcome! The main blocker is reading the OAuth token โ€” everything else is cross-platform.


โš ๏ธ Limitations

  • macOS only for now โ€” the OAuth token lives in macOS Keychain. Happy to accept PRs for other platforms.
  • Undocumented API headers โ€” Anthropic could change these anytime. If it breaks, open an issue.

๐Ÿ“ License

MIT


Built by @craakash โ€” because checking usage shouldn't require opening another app.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_plan_usage-0.1.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_plan_usage-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file claude_plan_usage-0.1.1.tar.gz.

File metadata

  • Download URL: claude_plan_usage-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for claude_plan_usage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7e830e2c564cde5b23a155674df01cf7df768b883ae57cc6b6b291e11b64b4ab
MD5 97bef67cadf0e666ed818bb20a3ff72c
BLAKE2b-256 ec476ae2103b1a50b44a97e12c1614288cec8faeeae9e8a90e508b2e9c157a3b

See more details on using hashes here.

File details

Details for the file claude_plan_usage-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_plan_usage-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 144ae6d7573d643d224163cfcd9308eddec392c5c12ae97c63c2d25a920b1342
MD5 a72b6f27745531b8cf6580429b5858f0
BLAKE2b-256 b8e2107c58e8e881b46ec43079cb943842636acb3f66c185386e130b7b05c806

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page