ai-agent-usage-analyzer
v1.0.1
Published
Unified AI coding assistant usage analyzer - supports Claude Code, Cursor, OpenCode, Codex CLI, Gemini CLI
Readme
ai-agent-usage-analyzer
Unified CLI tool that aggregates and analyzes AI coding assistant usage across multiple platforms. Tracks sessions, tokens, costs, tool usage, and code changes — then generates an interactive HTML dashboard.
Supported Providers
| Provider | Source | Tracks |
|----------|--------|--------|
| Claude Code | ~/.claude/projects/ | tokens, cost, tools, git branch |
| Cursor | ~/Library/Application Support/Cursor/ | tools, code changes |
| OpenCode | ~/.local/share/opencode/ | tokens, cost, code changes |
| Codex CLI | ~/.codex/sessions/ | tokens, cost, tools |
| Gemini CLI | ~/.gemini/tmp/ | tokens, cost, tools |
Providers are auto-detected based on what's installed on your system.
Install
# Global install
npm install -g
# Or run directly without installing
npx ai-agent-usage-analyzerUses better-sqlite3 (native) with automatic sql.js fallback if the native build fails.
Usage
# Today (default)
ai-agent-usage-analyzer
# Yesterday
ai-agent-usage-analyzer --yesterday
# Specific date
ai-agent-usage-analyzer --date 2026-03-08
# Date range
ai-agent-usage-analyzer --from 2026-03-01 --to 2026-03-09
# Current / previous month
ai-agent-usage-analyzer --this-month
ai-agent-usage-analyzer --last-month
# All time
ai-agent-usage-analyzer --all
# Filter by provider
ai-agent-usage-analyzer --provider claude-code,cursor
# Load all providers (even if not installed)
ai-agent-usage-analyzer --all-providers
# Import Cursor API usage CSV
ai-agent-usage-analyzer --csv ~/cursor-export.csv
# Custom output directory
ai-agent-usage-analyzer --output /tmp/my-reportOutput
ai-usage-export/
├── report.html # Interactive dashboard (auto-opens in browser)
├── exports/ # Plain text session transcripts
└── sessions/ # Individual HTML session pagesThe HTML report includes:
- Cost and token summaries per provider/model
- Hourly and daily activity distribution charts
- Tool usage breakdown
- Filterable session table with search
- Clickable session detail pages with full conversation transcripts
Pricing
Token costs are calculated using model pricing from OpenRouter. Pricing snapshots are cached in data/pricing-snapshots.json and auto-updated on each run when online.
License
MIT
