Claude Usage Analyzer
Analyze your Claude AI usage logs and calculate costs from ~/.claude or Docker containers.
Quick Start
Option 1: Run directly with uvx (recommended)
uvx claude-usage-analyzer
Option 2: Clone and run
git clone https://github.com/heswithme/claude-usage-analyzer.git
cd claude-usage-analyzer
uv run .
Usage
# Analyze local ~/.claude directory (default)
uvx claude-usage-analyzer
# Analyze Docker containers
uvx claude-usage-analyzer --docker
# Export results to JSON
uvx claude-usage-analyzer --output results.json
# Show only summary
uvx claude-usage-analyzer --summary-only
# Show tool usage statistics
uvx claude-usage-analyzer --tools
# Show cache efficiency analytics
uvx claude-usage-analyzer --cache
# Show response time analysis
uvx claude-usage-analyzer --response-times
# Show all enhanced analytics
uvx claude-usage-analyzer --full
# Limit items shown in tables
uvx claude-usage-analyzer --limit 5
Features
- Zero Installation: Just clone and run with
uv - Comprehensive Stats: Token usage, costs, sessions, daily trends
- Docker Support: Analyze usage from devcontainers (auto-analyzes all containers)
- Session Deduplication: Automatically detects and merges duplicate sessions across sources
- Rich Terminal UI: Beautiful tables and formatting
- Cost Tracking: Automatic calculation based on current Claude API pricing
- Cache Analytics: Track cache efficiency, ROI, and savings
- Response Time Analysis: Monitor performance by model and percentiles
- Enhanced Tool Analytics: Cost per tool, usage patterns, and combinations
Example Output
╭──────────────────────────────────────────╮
│ Claude Usage Analyzer │
│ Analyzing your Claude AI usage and costs │
╰──────────────────────────────────────────╯
Overall Usage Statistics
Total Messages 1,213
Input Tokens 2,661
Output Tokens 68,265
Cache Creation Tokens 3,257,802
Cache Read Tokens 98,725,473
Total Tokens 102,054,201
Total Cost $251.35
Model Usage Breakdown
┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Model ┃ Messages ┃ Input ┃ Output ┃ Cache ┃ Cost ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━┩
│ claude-opus-4-20250514 │ 1,204 │ 2,661 │ 68,265 │ 101,983,275 │ $251.35 │
└────────────────────────┴───────────┴────────┴────────┴─────────────┴─────────┘
Daily Usage
┏━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Date ┃ Messages ┃ Sessions ┃ Tokens ┃ Cost ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩
│ 2025-06-12 │ 82 │ 1 │ 3,602,253 │ $11.10 │
│ 2025-06-11 │ 1,209 │ 2 │ 101,998,767 │ $251.10 │
└────────────┴──────────┴──────────┴─────────────┴─────────┘
Session Breakdown
┏━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Session ID ┃ Messages ┃ Duration ┃ Models ┃ Cost ┃
┡━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ 3885ab53... │ 768 │ 3h 1m │ opus, <synthetic> │ $159.41 │
│ 7701daad... │ 441 │ 2h 34m │ opus, <synthetic> │ $91.69 │
│ ca45556d... │ 82 │ 34m │ opus │ $11.10 │
└─────────────┴──────────┴──────────┴───────────────────┴─────────┘
Requirements
- Python 3.8+
- uv (install with
curl -LsSf https://astral.sh/uv/install.sh | sh) - Docker (optional, for container support)
License
MIT
Metadata
Release files for claude-usage-analyzer 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_usage_analyzer-0.4.0.tar.gz | 33.1 kB | Without provenance | Details for claude_usage_analyzer-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_usage_analyzer-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for claude_usage_analyzer-0.4.0-py3-none-any.whl |
Total release size: 56.0 kB
Release files / claude_usage_analyzer-0.4.0.tar.gz
| Download URL | claude_usage_analyzer-0.4.0.tar.gz |
|---|---|
| Size | 33.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bef09afd50717ad759cde137613831ad8f9a5b9833a7ccb603f547594d1ab64
|
|
BLAKE2b-256 checksum How to use checksums |
4554301f1437edb1925b0fbdfa16f3f250a990a4b5ef600936a4c984f2a703b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Release files / claude_usage_analyzer-0.4.0-py3-none-any.whl
| Download URL | claude_usage_analyzer-0.4.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17814e9d9bc0cfed50db09dc4c149d5323628360cc4144f3ba95ad6860415fab
|
|
BLAKE2b-256 checksum How to use checksums |
dbe5671e4688aa08bcaa7826a75f1ed499e3bcd2fa38b35971be8ba8d658981b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Security for claude-usage-analyzer 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.