In the era of "Vibe Coding", AI-powered coding assistants have become a cornerstone of the modern development workflow. Anthropic's Claude Code stands out as a particularly potent ally, capable of understanding vast codebases and accelerating complex programming tasks. Yet, for all its power, developers often face a common and frustrating bottleneck: the opaque and unforgiving nature of token usage limits. An intense coding session can be abruptly halted by a sudden "session ended" message, leaving developers in the dark about their consumption.

Addressing this critical pain point head-on is the Claude Code Usage Monitor, a beautifully designed, open-source terminal tool created by developer Maciek-roboblog. This is not merely a counter; it is a comprehensive command center for your Claude AI interactions. It provides real-time tracking, visual progress bars, intelligent burn rate calculations, and smart predictions to transform your token management from a reactive guessing game into a proactive, strategic advantage. This article provides a definitive guide on how to install, use, and master this indispensable utility.

Why Do You Need Claude Code Usage Monitor
To appreciate the monitor's value, one must first understand the challenge it solves. Claude Code's usage is governed by a 5-hour rolling session window system. A session, with its corresponding token limit, begins with your very first message to Claude and expires exactly five hours later. Crucially, a developer can have multiple, overlapping sessions active simultaneously. If you start a new conversation at 10:30 AM, Session A begins. If you start another at 12:15 PM, Session B runs concurrently with Session A.
This system, while flexible, makes manual tracking a near-impossible task. Which session's limit are you approaching? What is your combined token consumption rate? Without a dedicated tool, developers are flying blind, unable to plan their work effectively and constantly at risk of being cut off mid-thought, disrupting their focus and derailing productivity.
How to Install and Setup Claude Code Usage Monitor
Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?
Apidog delivers all your demands, and replaces Postman at a much more affordable price!
The Claude Code Usage Monitor is designed for easy adoption, offering both a quick start for testing and a robust, production-ready setup that is highly recommended for daily use.
Prerequisites
Before you begin, ensure your system has the following installed:
- Python 3.6+
- Node.js (for installing the underlying
ccusage
CLI tool)
Quick Start (For Testing Only)
For a rapid evaluation, you can use the following commands:Bash
# 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 ccusage_monitor.py
While simple, this method installs packages globally and is not ideal for long-term stability or project isolation.
Production Setup (Recommended)
For a clean, stable, and professional setup, using a Python virtual environment is non-negotiable. It isolates project dependencies, prevents conflicts with your system's Python installation, and makes the project easily portable and reproducible.
Step-by-Step Guide:
Install ccusage
Globally: This core dependency fetches the usage data from Claude.Bash
npm install -g ccusage
Clone the Repository:Bash
git clone https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor.git
cd Claude-Code-Usage-Monitor
Create a Virtual Environment:Bash
# This creates a 'venv' folder in your project directory
python3 -m venv venv
Activate the Virtual Environment: You must do this every time you start a new terminal session to work on the project.Bash
# On Linux/macOS:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
Your command prompt should now be prefixed with (venv)
, indicating the environment is active.
Install Python Dependencies: With the virtual environment active, install the necessary packages.Bash
pip install pytz
Make the Script Executable (Optional, for Linux/macOS):Bash
chmod +x ccusage_monitor.py
Run the Monitor:Bash
# On Linux/macOS (if made executable):
./ccusage_monitor.py
# On all systems:
python ccusage_monitor.py
Daily Usage and Pro Tips
Once set up, your daily workflow becomes simple:Bash
cd Claude-Code-Usage-Monitor
source venv/bin/activate
./ccusage_monitor.py
# When finished, simply type:
deactivate
For maximum efficiency, create a shell alias. Add the following line to your ~/.bashrc
or ~/.zshrc
file:Bash
alias claude-monitor='cd ~/path/to/Claude-Code-Usage-Monitor && source venv/bin/activate && ./ccusage_monitor.py'
Now, you can launch the monitor from anywhere by simply typing claude-monitor
in your terminal.
Mastering the Monitor: Usage and Configuration
Running the monitor is as simple as executing the script, but its true power is unlocked through its command-line options.
Basic Usage:
To run with the default settings (Pro plan, ~7,000 tokens) and gracefully exit, press Ctrl+C.
Configuration Options:
Specify Your Plan: Tailor the monitor to your subscription level for accurate limits.Bash
# Pro plan (~7,000 tokens) - Default
./ccusage_monitor.py --plan pro
# Max5 plan (~35,000 tokens)
./ccusage_monitor.py --plan max5
# Max20 plan (~140,000 tokens)
./ccusage_monitor.py --plan max20
# Auto-detect from your highest previous session
./ccusage_monitor.py --plan custom_max
Customize Reset Times and Timezones: The monitor defaults to Europe/Warsaw
. Align it with your local workday for more intuitive planning.Bash
# Set reset time to 9 AM in US Eastern Time
./ccusage_monitor.py --reset-hour 9 --timezone US/Eastern
# Use UTC for international team collaboration
./ccusage_monitor.py --timezone UTC
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 | Users with variable/unknown limits |
Under the Hood: Smart Features and How They Work
The monitor's elegance lies in its sophisticated backend features that provide clear, actionable insights.
- Real-time Monitoring: The tool refreshes every 3 seconds with a smooth, flicker-free display, giving you a live look at your token consumption.
- Visual Progress Bars: Color-coded bars for token and time progress provide an immediate, intuitive understanding of your status. Green means you're safe, yellow is a warning, and red indicates you're near the limit.
- Smart Predictions: The monitor doesn't just show current usage; it analyzes your token consumption over the last hour to calculate a "burn rate." Based on this velocity, it predicts if you will exhaust your tokens before the session resets and displays a warning.
- Smart Plan Switching: If you run the monitor on the default
pro
plan but your usage exceeds the ~7,000 token limit, the tool is smart enough to notice. It will automatically switch tocustom_max
mode, scan your history to find your actual higher limit, and continue monitoring seamlessly, notifying you of the change.
Real-World Workflows and Best Practices
Integrate the monitor into your development habits to maximize its benefits.
Common Scenarios:
- The Morning Developer: Start your day by aligning the monitor with your work schedule. Bash
# Align resets with a 9 AM start in New York
./ccusage_monitor.py --plan max5 --reset-hour 9 --timezone America/New_York
- The Heavy User with Variable Limits: If you're unsure of your exact token limit, let the monitor figure it out for you. Bash
# Auto-detect your highest previous usage
./ccusage_monitor.py --plan custom_max
- The Workflow Integrator: Run the monitor in a dedicated
tmux
orscreen
window for persistent monitoring that you can attach to anytime. Bash
tmux new-session -d -s claude-monitor './ccusage_monitor.py --plan max20'
# Check status later
tmux attach -t claude-monitor
Best Practices:
- Start Early: Launch the monitor at the beginning of your coding session for the most accurate tracking and predictions.
- Use a Virtual Environment: This is the #1 best practice for a stable, conflict-free experience.
- Monitor Your Burn Rate: If you see the rate spiking, consider less token-intensive tasks as you approach your limit. Plan large refactors or code generation for when you have a fresh session.
- Set Your Timezone: Always use the
--timezone
flag for accurate reset time predictions that align with your mental clock.
Troubleshooting
If you encounter the No active session found
error, here are the steps to resolve it:
- Initialize a Session: Go to the Claude web interface and send at least two messages. This ensures a session is properly initialized and logged.
- Specify Config Path (If Needed): In rare cases, the path to Claude's configuration may be non-standard. You can specify it manually: Bash
CLAUDE_CONFIG_DIR=~/.config/claude ./ccusage_monitor.py
Conclusion: Taking Command of Your AI Workflow
The Claude Code Usage Monitor is a powerful example of how community-driven, open-source tools can solve practical problems that developers face daily. It elevates the user from a passive victim of opaque limits to an empowered commander of their own workflow. By providing clarity, predictability, and control, this tool allows you to harness the full power of Claude Code without the constant fear of interruption. It's an essential utility for any serious developer looking to integrate AI seamlessly and efficiently into their craft.
Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?
Apidog delivers all your demands, and replaces Postman at a much more affordable price!