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.
- ✨ Key Features
- 🚀 Installation
- 📖 Usage
- ✨ Features & How It Works
- 🚀 Usage Examples
- 📞 Contact
- 📚 Additional Documentation
- 🔄 Real-time monitoring - Updates every 3 seconds with smooth refresh
- 📊 Visual progress bars - Beautiful color-coded token and time progress bars
- 🔮 Smart predictions - Calculates when tokens will run out based on current burn rate
- 🤖 Auto-detection - Automatically switches to custom max when Pro limit is exceeded
- 📋 Multiple plan support - Works with Pro, Max5, Max20, and auto-detect plans
- ⚠️ Warning system - Alerts when tokens exceed limits or will deplete before session reset
- 💼 Professional UI - Clean, colorful terminal interface with emojis
- ⏰ Customizable scheduling - Set your own reset times and timezones
For immediate testing (not recommended for regular use):
- Python 3.6+ installed on your system
- Node.js for ccusage CLI tool
Using a virtual environment is strongly recommended because:
- 🛡️ Isolation: Keeps your system Python clean and prevents dependency conflicts
- 📦 Portability: Easy to replicate the exact environment on different machines
- 🔄 Version Control: Lock specific versions of dependencies for stability
- 🧹 Clean Uninstall: Simply delete the virtual environment folder to remove everything
- 👥 Team Collaboration: Everyone uses the same Python and package versions
If you don't have venv module available:
Alternatively, use the virtualenv package:
After initial setup, you only need:
Create an alias for quick access:
The default timezone is Europe/Warsaw. Change it to any valid timezone:
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 |
- Updates every 3 seconds with smooth refresh
- No screen flicker - intelligent display updates
- Live token consumption tracking across multiple sessions
- Token Progress: Color-coded bars showing current usage vs limits
- Time Progress: Visual countdown to next session reset
- Burn Rate Indicator: Real-time consumption velocity
- Calculates when tokens will run out based on current burn rate
- Warns if tokens will deplete before next session reset
- Analyzes usage patterns from the last hour
- Smart Plan Switching: Automatically switches from Pro to custom_max when limits exceeded
- Limit Discovery: Scans previous sessions to find your actual token limits
- Intelligent Notifications: Shows when automatic switches occur
Claude Code operates on a 5-hour rolling session window system:
- Session Start: Begins with your first message to Claude
- Session Duration: Lasts exactly 5 hours from that first message
- Token Limits: Apply within each 5-hour session window
- Multiple Sessions: Can have several active sessions simultaneously
- Rolling Windows: New sessions can start while others are still active
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:
The monitor calculates burn rate using sophisticated analysis:
- Data Collection: Gathers token usage from all sessions in the last hour
- Pattern Analysis: Identifies consumption trends across overlapping sessions
- Velocity Tracking: Calculates tokens consumed per minute
- Prediction Engine: Estimates when current session tokens will deplete
- Real-time Updates: Adjusts predictions as usage patterns change
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 |
custom_max | Scans all previous sessions, uses highest token count found | Users with variable/unknown limits |
When using the default Pro plan:
- Detection: Monitor notices token usage exceeding 7,000
- Analysis: Scans previous sessions for actual limits
- Switch: Automatically changes to custom_max mode
- Notification: Displays clear message about the change
- Continuation: Keeps monitoring with new, higher limit
The auto-detection system:
- Scans History: Examines all available session blocks
- Finds Peaks: Identifies highest token usage achieved
- Validates Data: Ensures data quality and recency
- Sets Limits: Uses discovered maximum as new limit
- Learns Patterns: Adapts to your actual usage capabilities
Scenario: You start work at 9 AM and want tokens to reset aligned with your schedule.
Benefits:
- Reset times align with your work schedule
- Better planning for daily token allocation
- Predictable session windows
Scenario: You often work past midnight and need flexible reset scheduling.
Strategy:
- Plan heavy coding sessions around reset times
- Use late resets to span midnight work sessions
- Monitor burn rate during peak hours
Scenario: Your token limits seem to change, and you're not sure of your exact plan.
Approach:
- Let auto-detection find your real limits
- Monitor for a week to understand patterns
- Note when limits change or reset
Scenario: You're working across different timezones or traveling.
Scenario: You just want to see current status without configuration.
Start with Default (Recommended for New Users)
- Monitor will detect if you exceed Pro limits
- Automatically switches to custom_max if needed
- Shows notification when switching occurs
Known Subscription Users
Unknown Limits
-
Start Early in Sessions
# Begin monitoring when starting Claude work ./ccusage_monitor.py- Gives accurate session tracking from the start
- Better burn rate calculations
- Early warning for limit approaches
-
Use Virtual Environment
# Production setup with isolation python3 -m venv venv source venv/bin/activate pip install pytz- Prevents dependency conflicts
- Clean uninstallation
- Reproducible environments
-
Custom Shell Alias
# Add to ~/.bashrc or ~/.zshrc alias claude-monitor='cd ~/Claude-Code-Usage-Monitor && source venv/bin/activate && ./ccusage_monitor.py'
-
Monitor Burn Rate Velocity
- Watch for sudden spikes in token consumption
- Adjust coding intensity based on remaining time
- Plan big refactors around session resets
-
Strategic Session Planning
# Plan heavy usage around reset times ./ccusage_monitor.py --reset-hour 9- Schedule large tasks after resets
- Use lighter tasks when approaching limits
- Leverage multiple overlapping sessions
-
Timezone Awareness
# Always use your actual timezone ./ccusage_monitor.py --timezone Europe/Warsaw- Accurate reset time predictions
- Better planning for work schedules
- Correct session expiration estimates
-
Terminal Setup
- Use terminals with at least 80 character width
- Enable color support for better visual feedback
- Consider dedicated terminal window for monitoring
-
Workflow Integration
# Start monitoring with your development session tmux new-session -d -s claude-monitor './ccusage_monitor.py' # Check status anytime tmux attach -t claude-monitor -
Multi-Session Strategy
- Remember sessions last exactly 5 hours
- You can have multiple overlapping sessions
- Plan work across session boundaries
Large Project Development
Daily Routine:
- 8:00 AM: Fresh tokens, start major features
- 10:00 AM: Check burn rate, adjust intensity
- 12:00 PM: Monitor for afternoon session planning
- 2:00 PM: New session window, tackle complex problems
- 4:00 PM: Light tasks, prepare for evening session
Learning & Experimentation
Sprint Development
Have questions, suggestions, or want to collaborate? Feel free to reach out!
📧 Email: [email protected]
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!
- Development Roadmap - ML features, PyPI package, Docker plans
- Contributing Guide - How to contribute, development guidelines
- Troubleshooting - Common issues and solutions
MIT License - feel free to use and modify as needed.
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.