How to Monitor Claude Code Usage in Real-time with this Open Source Tool:

Audrey Lopez

Audrey Lopez

20 June 2025

How to Monitor Claude Code Usage in Real-time with this Open Source Tool:

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 a great API Testing tool that generates beautiful API Documentation?

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!
button

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:

  1. Python 3.6+
  2. 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.

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
PlanToken LimitBest For
pro~7,000Light usage, testing (default)
max5~35,000Regular development
max20~140,000Heavy usage, large projects
custom_maxAuto-detectUsers 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-World Workflows and Best Practices

Integrate the monitor into your development habits to maximize its benefits.

Common Scenarios:

# Align resets with a 9 AM start in New York
./ccusage_monitor.py --plan max5 --reset-hour 9 --timezone America/New_York
# Auto-detect your highest previous usage
./ccusage_monitor.py --plan custom_max
tmux new-session -d -s claude-monitor './ccusage_monitor.py --plan max20'
# Check status later
tmux attach -t claude-monitor

Best Practices:

  1. Start Early: Launch the monitor at the beginning of your coding session for the most accurate tracking and predictions.
  2. Use a Virtual Environment: This is the #1 best practice for a stable, conflict-free experience.
  3. 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.
  4. 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:

  1. Initialize a Session: Go to the Claude web interface and send at least two messages. This ensures a session is properly initialized and logged.
  2. 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 a great API Testing tool that generates beautiful API Documentation?

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!
button

Explore more

Why Are KYC APIs Essential for Modern Financial Compliance Success

Why Are KYC APIs Essential for Modern Financial Compliance Success

Discover why KYC APIs are transforming financial compliance. Learn about document verification, AML checks, biometric authentication, and implementation best practices.

16 July 2025

What is Async API and Why Should Every Developer Care About It

What is Async API and Why Should Every Developer Care About It

Discover what AsyncAPI is and why it's essential for modern event-driven applications. Learn about asynchronous API documentation, real-time messaging, and how AsyncAPI differs from REST APIs.

16 July 2025

Voxtral: Mistral AI's Open Source Whisper Alternative

Voxtral: Mistral AI's Open Source Whisper Alternative

For the past few years, OpenAI's Whisper has reigned as the undisputed champion of open-source speech recognition. It offered a level of accuracy that democratized automatic speech recognition (ASR) for developers, researchers, and hobbyists worldwide. It was a monumental leap forward, but the community has been eagerly awaiting the next step—a model that goes beyond mere transcription into the realm of true understanding. That wait is now over. Mistral AI has entered the ring with Voxtral, a ne

15 July 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs