Agent Stats - AI Usage Tracker
A VS Code extension for tracking and analyzing your Claude Code AI usage metrics, similar to WakaTime but for AI.
Website: agentstats.dev
Features
- Automatic Detection: Automatically discovers Claude Code JSONL data files from default locations
- Real-time Tracking: Monitors AI usage and updates metrics every 5-10 minutes
- Cost Calculation: Calculates costs based on current Claude model pricing (Opus, Sonnet, Haiku)
- Status Bar Integration: Shows today's cost and token usage in the VS Code status bar
- Detailed Statistics: View usage by model, session, day, week, and month
- Auto-Export: Automatically exports metrics to JSON after collecting a configurable number of activities
- Dashboard: Interactive webview dashboard with comprehensive statistics
Tracked Metrics
- Input tokens
- Output tokens
- Cache creation tokens
- Cache read tokens
- Total tokens
- Cost (USD)
- Model used
- Session information
- Project path
Data Sources
The extension reads Claude Code JSONL files from:
- New location (Claude Code >= v1.0.30):
~/.config/claude/projects/
- Legacy location:
~/.claude/projects/
You can also configure custom paths in settings.
Configuration
| Setting |
Default |
Description |
agentStats.claudeDataPaths |
[] |
Custom paths to Claude Code data directories |
agentStats.refreshIntervalMinutes |
5 |
How often to refresh metrics (1-60 minutes) |
agentStats.showStatusBar |
true |
Show statistics in status bar |
agentStats.statusBarDisplayMode |
"both" |
What to display: "tokens", "requests", or "both" |
agentStats.historicalDataDays |
30 |
Days of historical data to load (max 365) |
agentStats.apiKey |
"" |
Your AgentStats API key from agentstats.dev |
agentStats.syncIntervalMinutes |
5 |
How often to sync metrics to the cloud (1-60 minutes) |
Commands
AgentStats: Show Dashboard - Open the metrics dashboard
AgentStats: Refresh Metrics Now - Force refresh metrics
AgentStats: Configure Claude Data Path - Set custom data directory
AgentStats: Show Today's Statistics - Quick view of today's usage
AgentStats: Open Settings - Open extension settings panel
AgentStats: Sync to Cloud Now - Manually sync metrics to agentstats.dev
AgentStats: Force Full Resync - Resync all historical data with prompts
Supported Models
- Claude Opus 4.5
- Claude Sonnet 4
- Claude 3.5 Sonnet (v1 & v2)
- Claude 3.5 Haiku
- Claude 3 Opus
- Claude 3 Sonnet
- Claude 3 Haiku
Cloud Sync
AgentStats can optionally sync your metrics to agentstats.dev for:
- Cross-device tracking
- Long-term analytics
- Web dashboard access
To enable cloud sync:
- Get an API key from agentstats.dev
- Set
agentStats.apiKey in settings
- Metrics sync automatically every 5 minutes
License
MIT
| |