ワンクリックで
claude-code-usage-monitor
Monitor Claude AI token usage in real-time with ML predictions, cost analytics, and session limit warnings
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Monitor Claude AI token usage in real-time with ML predictions, cost analytics, and session limit warnings
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create AI marketing videos and images using Arcads API — Seedance, Sora, Veo, Kling, Nano Banana, ChatGPT Image, and multi-step ad pipelines
Generate AI marketing videos and static image ads using the Arcads API with skills for Seedance 2.0, Sora 2, Veo 3.1, Kling 3.0, Nano Banana, and 37 Meta ad templates
Create AI marketing videos and images using Arcads API with Seedance 2.0, Sora 2, Veo 3.1, Kling 3.0, Nano Banana, and 37 static Meta ad templates
Generate AI marketing videos and images using Arcads creative stack (Seedance 2.0, Sora 2, Veo 3.1, Kling, Nano Banana, ChatGPT Image) from Claude Code or Cursor
Generate AI marketing videos and static image ads using Arcads external API with Seedance 2.0, Sora 2, Veo 3.1, Kling, Nano Banana, and 37-template Meta image library
Create AI marketing videos and static Meta image ads using the Arcads API with Seedance 2.0, Sora 2, Veo 3.1, Kling, Nano Banana, ChatGPT Image, and 37 static ad templates
| name | claude-code-usage-monitor |
| description | Monitor Claude AI token usage in real-time with ML predictions, cost analytics, and session limit warnings |
| triggers | ["how do I monitor my Claude token usage","track Claude API usage and costs","set up Claude usage monitoring","check my Claude token limits","monitor Claude Code session usage","predict when I'll hit Claude limits","analyze Claude usage patterns","configure Claude usage alerts"] |
Skill by ara.so — Claude Code Skills collection.
Claude Code Usage Monitor is a real-time terminal monitoring tool that tracks Claude AI token consumption, provides ML-based predictions for session limits, calculates costs, and warns you before hitting usage caps. It supports multiple Claude plans (Pro, Max5, Max20, Custom) with auto-detection, P90 percentile analysis, and intelligent session tracking.
Key capabilities:
# Install from PyPI
uv tool install claude-monitor
# Install from source
git clone https://github.com/Maciek-roboblog/Claude-Code-Usage-Monitor.git
cd Claude-Code-Usage-Monitor
uv tool install .
# Install from PyPI
pip install claude-monitor
# Add to PATH if needed
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
pipx install claude-monitor
The monitor can be invoked with multiple aliases:
# Primary command
claude-monitor
# Alternatives
claude-code-monitor # Full name
cmonitor # Short
ccmonitor # Alternative short
ccm # Shortest
# Default: Custom plan with auto-detection
claude-monitor
# Specify plan type
claude-monitor --plan pro # Pro plan (~44k tokens)
claude-monitor --plan max5 # Max5 plan (~88k tokens)
claude-monitor --plan max20 # Max20 plan (~220k tokens)
claude-monitor --plan custom # Custom with P90 detection
# Custom token limit
claude-monitor --plan custom --custom-limit-tokens 100000
# Change view mode
claude-monitor --view realtime # Live monitoring (default)
claude-monitor --view daily # Daily aggregation
claude-monitor --view monthly # Monthly aggregation
# Configure refresh rates
claude-monitor --refresh-rate 5 # Data refresh (1-60s)
claude-monitor --refresh-per-second 1.0 # Display refresh (0.1-20 Hz)
# Set daily reset time
claude-monitor --reset-hour 3 # Reset at 3 AM
# Theme and display
claude-monitor --theme dark # dark, light, classic, auto
claude-monitor --time-format 24h # 24h or 12h
claude-monitor --timezone "America/New_York"
# Logging
claude-monitor --log-level DEBUG
claude-monitor --log-file ~/claude-monitor.log
claude-monitor --debug
# Utility
claude-monitor --version
claude-monitor --help
claude-monitor --clear # Clear saved config
| Plan | Token Limit | Cost Limit | Use Case |
|---|---|---|---|
pro | 44,000 | $18.00 | Claude Pro subscription |
max5 | 88,000 | $35.00 | Claude Max5 subscription |
max20 | 220,000 | $140.00 | Claude Max20 subscription |
custom | P90-based | $50.00 (default) | Auto-detection with ML |
Settings are automatically saved to ~/.claude-monitor/last_used.json:
# First run - save preferences
claude-monitor --plan pro --theme dark --timezone "Europe/London" --refresh-rate 5
# Next run - preferences restored
claude-monitor --plan pro
# Override saved settings
claude-monitor --plan pro --theme light
# Clear all saved preferences
claude-monitor --clear
What gets saved:
--view)--theme)--timezone)--time-format)--refresh-rate, --refresh-per-second)--reset-hour)--custom-limit-tokens)Note: Plan selection (--plan) is never saved and must be specified each time.
While primarily a CLI tool, you can integrate it programmatically:
from claude_monitor.core.config import Config
from claude_monitor.core.data_fetcher import DataFetcher
from claude_monitor.core.analytics import SessionAnalyzer
from claude_monitor.models.plan import Plan
# Create configuration
config = Config(
plan=Plan.PRO,
refresh_rate=10,
theme="dark",
timezone="America/New_York"
)
# Initialize data fetcher
fetcher = DataFetcher(config)
# Fetch current usage
usage_data = fetcher.fetch_usage()
print(f"Tokens used: {usage_data.token_usage}")
print(f"Messages: {usage_data.message_count}")
print(f"Cost: ${usage_data.cost:.2f}")
# Analyze sessions with ML predictions
analyzer = SessionAnalyzer(config)
sessions = fetcher.fetch_sessions()
predictions = analyzer.analyze_sessions(sessions)
print(f"P90 token limit: {predictions.p90_tokens}")
print(f"Predicted session end: {predictions.estimated_end_time}")
# Custom plan optimized for 5-hour sessions
claude-monitor --plan custom --refresh-rate 15
# High-frequency monitoring for critical sessions
claude-monitor --plan max20 --refresh-rate 5 --refresh-per-second 2.0
# Debug mode with file logging
claude-monitor --plan pro --debug --log-file ./monitor.log
from claude_monitor.core.data_fetcher import DataFetcher
from claude_monitor.core.config import Config
config = Config()
fetcher = DataFetcher(config)
usage = fetcher.fetch_usage()
# Access cost breakdown
print(f"Total cost: ${usage.cost:.2f}")
print(f"Input tokens: {usage.input_tokens}")
print(f"Output tokens: {usage.output_tokens}")
print(f"Cache tokens: {usage.cache_read_tokens}")
# Model-specific costs
for model, tokens in usage.model_usage.items():
print(f"{model}: {tokens} tokens")
from claude_monitor.core.analytics import SessionAnalyzer
from claude_monitor.core.data_fetcher import DataFetcher
from claude_monitor.core.config import Config
config = Config(plan=Plan.CUSTOM)
fetcher = DataFetcher(config)
analyzer = SessionAnalyzer(config)
# Fetch last 8 days of sessions
sessions = fetcher.fetch_sessions()
# Analyze with P90 predictions
analysis = analyzer.analyze_sessions(sessions)
print(f"Total sessions: {len(sessions)}")
print(f"P90 tokens: {analysis.p90_tokens}")
print(f"P90 messages: {analysis.p90_messages}")
print(f"P90 cost: ${analysis.p90_cost:.2f}")
print(f"Burndown rate: {analysis.token_burndown_rate:.2f} tokens/min")
from claude_monitor.core.config import Config
from claude_monitor.models.plan import Plan
# Auto-detect custom limits from usage patterns
config = Config(
plan=Plan.CUSTOM,
# No custom_limit_tokens specified - will use P90 analysis
view="realtime"
)
# Or explicitly set custom limits
config = Config(
plan=Plan.CUSTOM,
custom_limit_tokens=150000, # 150k token limit
view="realtime"
)
from claude_monitor.ui.warnings import WarningGenerator
from claude_monitor.core.data_fetcher import DataFetcher
from claude_monitor.core.config import Config
config = Config(plan=Plan.PRO)
fetcher = DataFetcher(config)
warning_gen = WarningGenerator(config)
usage = fetcher.fetch_usage()
warnings = warning_gen.generate_warnings(usage)
for warning in warnings:
print(f"[{warning.level}] {warning.message}")
if warning.suggestion:
print(f" Suggestion: {warning.suggestion}")
The monitor stores configuration in ~/.claude-monitor/last_used.json:
{
"view": "realtime",
"theme": "dark",
"timezone": "America/New_York",
"time_format": "24h",
"refresh_rate": 10,
"refresh_per_second": 0.75,
"reset_hour": 0,
"custom_limit_tokens": 100000
}
# Set timezone
export TZ="America/New_York"
# Configure logging level
export CLAUDE_MONITOR_LOG_LEVEL=DEBUG
# Optional Sentry integration for error reporting
export SENTRY_DSN="your-sentry-dsn"
# Check yesterday's usage
claude-monitor --view daily --plan pro
# Export to file
claude-monitor --view daily --log-file daily-report.log
# Monitor with cost focus
claude-monitor --plan custom --theme dark --refresh-rate 10
# The custom plan prioritizes cost tracking for long sessions
# Watch the "Cost Usage" bar - most critical metric
# Team member in New York
claude-monitor --timezone "America/New_York" --time-format 12h
# Team member in London
claude-monitor --timezone "Europe/London" --time-format 24h
# Team member in Tokyo
claude-monitor --timezone "Asia/Tokyo" --time-format 24h
# Low-frequency updates for background monitoring
claude-monitor --refresh-rate 30 --refresh-per-second 0.5
# High-frequency for active development
claude-monitor --refresh-rate 5 --refresh-per-second 2.0
The monitor stores data in ~/.claude-monitor/:
~/.claude-monitor/
├── last_used.json # Saved preferences
├── usage_cache.json # Cached usage data
└── sessions_cache.json # Cached session data
# Check if installed
pip list | grep claude-monitor
# Add to PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Or use full path
~/.local/bin/claude-monitor
# Solution 1: Use uv (recommended)
uv tool install claude-monitor
# Solution 2: Use pipx
pipx install claude-monitor
# Solution 3: Virtual environment
python3 -m venv ~/claude-monitor-env
source ~/claude-monitor-env/bin/activate
pip install claude-monitor
# Enable debug logging
claude-monitor --debug --log-file debug.log
# Check API connectivity
cat ~/.claude-monitor/usage_cache.json
# Verify plan limits
claude-monitor --plan custom --custom-limit-tokens 100000
# Force theme
claude-monitor --theme light # or dark, classic
# Reset configuration
claude-monitor --clear
# Check terminal compatibility (requires 24-bit color support)
echo $COLORTERM # Should show "truecolor" or "24bit"
# Check system timezone
timedatectl # Linux
date +%Z # macOS
# Force specific timezone
claude-monitor --timezone UTC
# List valid timezones
python3 -c "import zoneinfo; print('\n'.join(sorted(zoneinfo.available_timezones())))"
# Reduce refresh rates
claude-monitor --refresh-rate 30 --refresh-per-second 0.5
# Check current settings
cat ~/.claude-monitor/last_used.json
# Clear all caches
rm -rf ~/.claude-monitor/
# Clear only config
claude-monitor --clear
#!/bin/bash
# monitor-session.sh
# Start monitoring in background
claude-monitor --plan pro --log-file session.log &
MONITOR_PID=$!
# Your work here
echo "Session started, monitoring in background..."
# Cleanup on exit
trap "kill $MONITOR_PID 2>/dev/null" EXIT
#!/bin/bash
# Track CI usage
claude-monitor --view daily --plan custom --log-file ci-usage.log
grep "Total Tokens" ci-usage.log | tail -1
#!/bin/bash
# alert-on-limit.sh
claude-monitor --plan pro --refresh-rate 60 --log-file usage.log &
PID=$!
while true; do
if grep -q "CRITICAL" usage.log; then
echo "Usage limit critical!" | mail -s "Claude Alert" admin@example.com
break
fi
sleep 300
done
kill $PID
The monitor respects Claude API rate limits:
Optimal refresh rates:
--refresh-rate 10 --refresh-per-second 1.0--refresh-rate 30 --refresh-per-second 0.5--refresh-rate 5 --refresh-per-second 2.0Resource usage:
Cache optimization:
MIT License - see project repository for details.