
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
claude-usage-monitor
Advanced tools
A beautiful real-time terminal monitoring tool for Claude AI token usage. Track your token consumption, burn rate, and get predictions about when you'll run out of tokens.
The fastest and easiest way to install and use the monitor:
If you don't have uv installed yet, get it with one command:
# Install uv (one-time setup)
# On Linux/macOS:
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# After installation, restart your terminal
# Install dependencies
npm install -g ccusage
# Clone and install the tool with uv
git clone https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor.git
cd Claude-Code-Usage-Monitor
uv tool install .
# Run from anywhere
ccusage-monitor
# or
claude-monitor
For immediate testing or development:
# Install dependencies
npm install -g ccusage
pip install pytz
# Clone and run
git clone https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor.git
cd Claude-Code-Usage-Monitor
python claude_monitor.py
Using a virtual environment is strongly recommended because:
If you don't have venv
module available:
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install python3-venv
# Fedora/RHEL/CentOS
sudo dnf install python3-venv
# macOS (usually comes with Python)
# If not available, install Python via Homebrew:
brew install python3
# Windows (usually comes with Python)
# If not available, reinstall Python from python.org
# Make sure to check "Add Python to PATH" during installation
Alternatively, use the virtualenv
package:
# Install virtualenv via pip
pip install virtualenv
# Then create virtual environment with:
virtualenv venv
# instead of: python3 -m venv venv
# 1. Install ccusage globally
npm install -g ccusage
# 2. Clone the repository
git clone https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor.git
cd Claude-Code-Usage-Monitor
# 3. Create virtual environment
python3 -m venv venv
# Or if using virtualenv package:
# virtualenv venv
# 4. Activate virtual environment
# On Linux/Mac:
source venv/bin/activate
# On Windows:
# venv\Scripts\activate
# 5. Install Python dependencies
pip install pytz
# 6. Make script executable (Linux/Mac only)
chmod +x claude_monitor.py
# 7. Run the monitor
python claude_monitor.py
After initial setup, you only need:
# Navigate to project directory
cd Claude-Code-Usage-Monitor
# Activate virtual environment
source venv/bin/activate # Linux/Mac
# venv\Scripts\activate # Windows
# Run monitor
./claude_monitor.py # Linux/Mac
# python claude_monitor.py # Windows
# When done, deactivate
deactivate
Create an alias for quick access:
# Add to ~/.bashrc or ~/.zshrc
alias claude-monitor='cd ~/Claude-Code-Usage-Monitor && source venv/bin/activate && ./claude_monitor.py'
# Then just run:
claude-monitor
# Default (Pro plan - 7,000 tokens)
claude-monitor
# Exit the monitor
# Press Ctrl+C to gracefully exit
# Default (Pro plan - 7,000 tokens)
./claude_monitor.py
# Exit the monitor
# Press Ctrl+C to gracefully exit
With uv tool installation:
# Pro plan (~7,000 tokens) - Default
claude-monitor --plan pro
# Max5 plan (~35,000 tokens)
claude-monitor --plan max5
# Max20 plan (~140,000 tokens)
claude-monitor --plan max20
# Auto-detect from highest previous session
claude-monitor --plan custom_max
Traditional/Development mode:
# Pro plan (~7,000 tokens) - Default
./claude_monitor.py --plan pro
# Max5 plan (~35,000 tokens)
./claude_monitor.py --plan max5
# Max20 plan (~140,000 tokens)
./claude_monitor.py --plan max20
# Auto-detect from highest previous session
./claude_monitor.py --plan custom_max
With uv tool installation:
# Reset at 3 AM
claude-monitor --reset-hour 3
# Reset at 10 PM
claude-monitor --reset-hour 22
Traditional/Development mode:
# Reset at 3 AM
./claude_monitor.py --reset-hour 3
# Reset at 10 PM
./claude_monitor.py --reset-hour 22
The default timezone is Europe/Warsaw. Change it to any valid timezone:
With uv tool installation:
# Use US Eastern Time
claude-monitor --timezone US/Eastern
# Use Tokyo time
claude-monitor --timezone Asia/Tokyo
# Use UTC
claude-monitor --timezone UTC
# Use London time
claude-monitor --timezone Europe/London
Traditional/Development mode:
# Use US Eastern Time
./claude_monitor.py --timezone US/Eastern
# Use Tokyo time
./claude_monitor.py --timezone Asia/Tokyo
# Use UTC
./claude_monitor.py --timezone UTC
# Use London time
./claude_monitor.py --timezone Europe/London
Plan | Token Limit | Best For |
---|---|---|
pro | ~7,000 | Light usage, testing (default) |
max5 | ~35,000 | Regular development |
max20 | ~140,000 | Heavy usage, large projects |
custom_max | Auto-detect | Uses highest from previous sessions |
Claude Code operates on a 5-hour rolling session window system:
Default reference times (in your configured timezone):
04:00
, 09:00
, 14:00
, 18:00
, 23:00
⚠️ Important: These are reference times for planning. Your actual token refresh happens exactly 5 hours after YOUR first message in each session.
Example Session Timeline:
10:30 AM - First message (Session A starts)
03:30 PM - Session A expires (5 hours later)
12:15 PM - First message (Session B starts)
05:15 PM - Session B expires (5 hours later)
The monitor calculates burn rate using sophisticated analysis:
Plan | Approximate Limit | Typical Usage |
---|---|---|
Claude Pro | ~7,000 tokens | Light coding, testing, learning |
Claude Max5 | ~35,000 tokens | Regular development work |
Claude Max20 | ~140,000 tokens | Heavy usage, large projects |
Plan | How It Works | Best For |
---|---|---|
custom_max | Scans all previous sessions, uses highest token count found | Users with variable/unknown limits |
When using the default Pro plan:
The auto-detection system:
Scenario: You start work at 9 AM and want tokens to reset aligned with your schedule.
# Set custom reset time to 9 AM
./claude_monitor.py --reset-hour 9
# With your timezone
./claude_monitor.py --reset-hour 9 --timezone US/Eastern
Benefits:
Scenario: You often work past midnight and need flexible reset scheduling.
# Reset at midnight for clean daily boundaries
./claude_monitor.py --reset-hour 0
# Late evening reset (11 PM)
./claude_monitor.py --reset-hour 23
Strategy:
Scenario: Your token limits seem to change, and you're not sure of your exact plan.
# Auto-detect your highest previous usage
claude-monitor --plan custom_max
# Monitor with custom scheduling
claude-monitor --plan custom_max --reset-hour 6
Approach:
Scenario: You're working across different timezones or traveling.
# US East Coast
claude-monitor --timezone America/New_York
# Europe
claude-monitor --timezone Europe/London
# Asia Pacific
claude-monitor --timezone Asia/Singapore
# UTC for international team coordination
claude-monitor --timezone UTC --reset-hour 12
Scenario: You just want to see current status without configuration.
# Just run it with defaults
ccusage-monitor
# Press Ctrl+C after checking status
Start with Default (Recommended for New Users)
# Pro plan detection with auto-switching
ccusage-monitor
Known Subscription Users
# If you know you have Max5
claude-monitor --plan max5
# If you know you have Max20
claude-monitor --plan max20
Unknown Limits
# Auto-detect from previous usage
claude-monitor --plan custom_max
Start Early in Sessions
# Begin monitoring when starting Claude work (uv installation)
ccusage-monitor
# Or development mode
./claude_monitor.py
Use Modern Installation (Recommended)
# Easy installation and updates with uv
uv tool install claude-usage-monitor
claude-monitor --plan max5
Custom Shell Alias (Legacy Setup)
# Add to ~/.bashrc or ~/.zshrc (only for development setup)
alias claude-monitor='cd ~/Claude-Code-Usage-Monitor && source venv/bin/activate && ./claude_monitor.py'
Monitor Burn Rate Velocity
Strategic Session Planning
# Plan heavy usage around reset times
claude-monitor --reset-hour 9
Timezone Awareness
# Always use your actual timezone
claude-monitor --timezone Europe/Warsaw
Terminal Setup
Workflow Integration
# Start monitoring with your development session (uv installation)
tmux new-session -d -s claude-monitor 'ccusage-monitor'
# Or development mode
tmux new-session -d -s claude-monitor './claude_monitor.py'
# Check status anytime
tmux attach -t claude-monitor
Multi-Session Strategy
Large Project Development
# Setup for sustained development
claude-monitor --plan max20 --reset-hour 8 --timezone America/New_York
Daily Routine:
Learning & Experimentation
# Flexible setup for learning
claude-monitor --plan pro
Sprint Development
# High-intensity development setup
claude-monitor --plan max20 --reset-hour 6
If you encounter the error No active session found
, please follow these steps:
Initial Test: Launch Claude Code and send at least two messages. In some cases, the session may not initialize correctly on the first attempt, but it resolves after a few interactions.
Configuration Path:
If the issue persists, consider specifying a custom configuration path. By default, Claude Code uses ~/.config/claude
. You may need to adjust this path depending on your environment.
CLAUDE_CONFIG_DIR=~/.config/claude ./claude_monitor.py
Have questions, suggestions, or want to collaborate? Feel free to reach out!
📧 Email: maciek@roboblog.eu
Whether you need help with setup, have feature requests, found a bug, or want to discuss potential improvements, don't hesitate to get in touch. I'm always happy to help and hear from users of the Claude Code Usage Monitor!
MIT License - feel free to use and modify as needed.
Want to contribute? Check out our Contributing Guide!
This tool builds upon the excellent ccusage by @ryoppippi, adding a real-time monitoring interface with visual progress bars, burn rate calculations, and predictive analytics.
⭐ Star this repo if you find it useful! ⭐
FAQs
A real-time terminal monitoring tool for Claude AI token usage
We found that claude-usage-monitor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.