A live-updating terminal dashboard for monitoring Claude account usage and rate limits. Supports dual-mode operation for both Claude Code users and organization administrators.
This tool monitors Claude account usage through multiple APIs, displaying real-time rate limits (Code mode) and personal Claude Code costs (Console mode) directly in your terminal. Automatically detects and switches between Code mode (personal usage) and Console mode (current user cost tracking).
- Dual Mode Support: Automatic detection between Code mode and Console mode
- Live Updates: Polls every 30 seconds (Code mode) or 5 minutes (Console mode)
- Code Mode:
- Profile Information: Display name, email, organization name
- Account Badges: Shows Enterprise, Pro, or Max account status
- Rate Limit Tier: Displays your current rate limit tier
- Progress Bars: Visual representation of usage percentage with color coding
- Multiple Rate Limits: Shows 5-hour and 7-day limits when active
- Reset Timer: Countdown to next rate limit reset
- Pace-Maker Integration: Displays throttling status and tempo tracking when Claude Pace Maker installed
- Console Mode:
- Personal Claude Code Usage: Shows ONLY your individual Claude Code usage costs
- MTD Tracking: Month-to-date spending for current user
- Cost Projections: End-of-month forecasting based on your usage rate
- Rate Calculation: Progressive window fallback (30min/1hr/3hr/6hr/24hr/7d) for accurate rate tracking
- In-Place Refresh: Clean display that updates without scrolling
- Auto Token Detection: Automatically loads OAuth credentials from Claude Code
- Token Expiry Handling: Detects expired tokens and prompts for refresh
- Narrow Console Friendly: Compact display optimized for small terminal windows
- Ctrl+C Handling: Clean exit on interrupt
- Python 3.6+
- Claude Code CLI installed and authenticated
Install directly from GitHub using pipx for isolated installation:
pipx install git+https://github.com/LightspeedDMS/claude-usage.gitInstall directly from GitHub using pip:
pip install git+https://github.com/LightspeedDMS/claude-usage.gitClone the repository and install:
git clone https://github.com/LightspeedDMS/claude-usage.git
cd claude-usage
pip install .For development with editable install:
git clone https://github.com/LightspeedDMS/claude-usage.git
cd claude-usage
pip install -e .After installation, run the monitor from anywhere:
claude-usageThe command is globally accessible from any directory.
Press Ctrl+C to stop monitoring.
The monitor automatically detects which mode to use based on available credentials:
- Code Mode: Uses Claude Code OAuth tokens (default for Claude Code users)
- Console Mode: Uses Anthropic Admin API key (for organization administrators)
Override automatic detection:
claude-usage --mode code # Force Code mode
claude-usage --mode console # Force Console modeBasic Display (OAuth only):
Claude Code Usage Monitor
Press Ctrl+C to stop
┌ Claude Code Usage ──────────────────────────┐
│ 👤 User (user@example.com) │
│ 🏢 Company Name ENTERPRISE │
│ ⚡ Tier: default_claude_max_5x │
│ │
│ 5-Hour Limit: ████████████████░░ 96% │
│ ⏰ Resets in: 1h 40m │
│ │
│ Updated: 20:19:18 │
└─────────────────────────────────────────────┘
With Pace-Maker Integration (when installed):
┌ Claude Code Usage ──────────────────────────────────────┐
│ 👤 John Doe (john@company.com) │
│ 🏢 Acme Corporation │
│ Plan: ENTERPRISE │
│ ⚡ Tier: default_claude_max_5x │
│ │
│ 5-Hour Usage: ████████████████░░░░ 78% │
│ ⏰ Resets in: 3h 45m │
│ │
│ 🎯 Pace Maker: ⚠️ THROTTLING │
│ 5-Hour Target: ████████████░░░░░░░░ 62% │
│ Deviation: +15.2% (over budget) │
│ ⏱️ Next delay: 45s per tool use │
│ Algorithm: adaptive/preload │
│ Tempo: enabled │
│ │
│ Updated: 21:04:36 │
└──────────────────────────────────────────────────────────┘
Progress Bar Color Coding:
- 🟢 0-50%: Green
- 🟡 51-80%: Yellow
- 🟠 81-99%: Orange
- 🔴 100%: Red
Console Mode (Admin API) - Current User Only:
┌ Console Usage ──────────────────────────────┐
│ 🏢 Acme Corporation │
│ │
│ ═══ Month-to-Date (November 2025) ═══ │
│ Your Claude Code Usage: $45.23 │
│ (john@company.com) │
│ │
│ Projected by end of month: $75.50 (+$30.27)│
│ Rate: $2.51/hour │
│ │
│ Updated: 14:23:15 │
└─────────────────────────────────────────────┘
Note: Console mode displays ONLY your personal Claude Code usage costs, not organization-wide spending.
This tool uses multiple Claude API endpoints:
Usage Data (OAuth):
GET https://api.anthropic.com/api/oauth/usage
Returns 5-hour and 7-day rate limit utilization percentages.
Profile Information (OAuth):
GET https://api.anthropic.com/api/oauth/profile
Returns user account details, organization info, and badges.
Console API Endpoints (Admin API):
GET https://api.anthropic.com/v1/organizations/me
GET https://api.anthropic.com/v1/organizations/usage_report/claude_code
GET https://api.anthropic.com/v1/organizations/users
The following endpoints are fetched internally but not displayed to users:
GET https://api.anthropic.com/v1/organizations/workspaces
GET https://api.anthropic.com/v1/organizations/cost_report
The monitor supports multiple authentication methods:
OAuth Authentication (Code Mode):
- Location:
~/.claude/.credentials.json - Token:
claudeAiOauth.accessToken - Used for: Usage data and profile information
Required headers:
Authorization: Bearer {accessToken}
Content-Type: application/json
anthropic-beta: oauth-2025-04-20
User-Agent: claude-code/2.0.37Admin API Authentication (Console Mode):
- Environment Variable:
ANTHROPIC_ADMIN_API_KEY=sk-ant-admin-... - Credentials File:
~/.claude/.credentials.jsonwithanthropicConsole.adminApiKey - Used for: Current user's Claude Code usage tracking and cost projections
Required headers:
x-api-key: {adminApiKey}
anthropic-version: 2023-06-01Usage Response:
{
"five_hour": {
"utilization": 78.0,
"resets_at": "2025-11-13T04:00:00+00:00"
},
"seven_day": null,
"seven_day_oauth_apps": null,
"seven_day_opus": null
}Profile Response:
{
"account": {
"uuid": "...",
"full_name": "User Name",
"display_name": "User",
"email": "user@example.com",
"has_claude_max": false,
"has_claude_pro": false
},
"organization": {
"uuid": "...",
"name": "Company Name",
"organization_type": "claude_enterprise",
"billing_type": "stripe_subscription_contracted",
"rate_limit_tier": "default_claude_max_5x"
}
}Claude Code implements multiple rate limit windows:
- 5-Hour Window: Primary rate limit shown in the monitor
- 7-Day Window: Extended rate limit (not always active)
- Organization-specific limits: Based on subscription tier
OAuth tokens have an expiration time tracked in the credentials file:
- Tokens are checked for expiry before each API call
- 5-minute buffer applied to prevent edge cases
- User prompted to refresh via
claudecommand when expired
Optional integration with Claude Pace Maker:
- Automatically detects Pace-Maker installation in
~/.claude-pace-maker - Reads throttling status from Pace-Maker database and config
- Displays real-time throttling decisions and delay timings
- Shows deviation from target pace and constrained window
- Shows tempo tracking status (enabled/disabled) with color coding
- No installation required - read-only integration
- Supports both adaptive and legacy pacing algorithms
If you see a token expiration error:
claudeRun any Claude Code command to refresh your authentication.
Ensure Claude Code is installed and you're authenticated:
which claude
claude --versionCheck your internet connection and verify you can reach the API:
curl -I https://api.anthropic.com- Requires valid Claude Code authentication (Code mode) or Admin API key (Console mode)
- Token refresh must be done manually via Claude Code CLI
- API endpoints are undocumented and may change
- Console mode limitations:
- Shows ONLY current user's Claude Code usage costs (not organization-wide)
- Limited to MTD period (current month only)
- Workspace spending limits not displayed
- Requires Admin API key for access
- Pace-Maker integration requires separate installation of Claude Pace Maker
Contributions welcome! Please open an issue or submit a pull request.
MIT License - See LICENSE file for details.
Built with the excellent Rich library for terminal UI.