Inspired by Claude Goblin by Kurt Buhler - A brilliant tool for analyzing Claude usage data. Kurt's innovative approach to persisting usage history beyond Claude Code's rolling 30-day window inspired this entire extension. Check out his work!
Claude Usage Analytics is a VS Code extension that provides real-time insights into your Claude Code usage. Built by Reid Havens of Analytic Endeavors, this tool transforms raw usage data into actionable intelligence—helping you understand costs, monitor usage patterns, and discover insights in your AI-assisted development workflow.
Track your Claude Code usage with real-time analytics in VS Code. Monitor costs, tokens, and subscription tier. Explore personality insights, achievement badges, and coding patterns. Features a 4-tab dashboard and 7 status bar widgets showing lifetime costs, daily spending, cache efficiency, and usage trends.
Seven live statistics widgets always visible at a glance:
| Widget | Icon | Displays | Click Action |
|---|---|---|---|
| Local History Cost | $(graph) |
Total spending (local storage) | Opens Overview tab |
| Today's Cost | $(calendar) |
Real-time current day usage | Opens Cost tab |
| Messages | $(comment-discussion) |
Total message count | Opens Messages tab |
| Tokens | $(symbol-number) |
Token consumption | Opens Messages tab |
| Personality | Emoji | Politeness score % | Opens Personality tab |
| Activity | Chart | Code blocks generated | Opens Personality tab |
| Subscription | $(pulse) |
Subscription tier (Max 20x, Pro, etc.) | Opens Overview tab |
A comprehensive 4-tab analytics panel with deep insights:
| Tab | Content |
|---|---|
| Overview | Hero stats, quick metrics, daily activity visualization, model distribution breakdown |
| Cost | Detailed cost analysis, 7-day trends, monthly projections, highest spending days, cache savings calculations |
| Messages | Token breakdown (input/output/cache), peak usage hours, activity patterns, session statistics |
| Personality | Achievement badges, personality trait scores, expression analysis, mood & sentiment tracking |
Understand exactly where your tokens go
- Real-time cost tracking with model-specific pricing (Opus vs Sonnet rates)
- Real-time today's cost calculated directly from conversation files
- Daily/weekly/monthly breakdowns with trend analysis
- Cost projections based on your usage patterns
- Cache savings calculator showing money saved through prompt caching
- Comparison metrics vs yesterday and vs average day
- Highest spending day identification
Discover your unique interaction style
- Politeness Score — Measures "please" and "thanks" frequency
- Frustration Index — Tracks caps lock usage, expletives, and facepalms
- Curiosity Score — Questions asked per message ratio
- Achievement Badges — Unlock milestones as you hit usage goals:
- Token Titan (1M+ tokens)
- Conversation Master (1000+ messages)
- Streak Champion (7+ day streak)
- Politeness Pro (80%+ politeness)
- ...and more!
Know your current plan at a glance
- Subscription tier display — Shows Max 20x, Max, Pro, or Free
- Plan information from Claude Code credentials
- Green status indicator when tier is detected
Analyze your coding patterns
- Code blocks generated with line counts
- Top programming languages used
- Request type distribution (debugging, features, explanations, refactoring)
- Peak hours analysis — when you're most active
- Night owl vs early bird scoring
Note: Code block statistics are collected from your extension install date forward. To include historical code stats, use the backfill script with your Claude.ai data export.
This extension prioritizes your privacy:
| Aspect | Implementation |
|---|---|
| Data Location | All data stays on your machine |
| Network Calls | None — fully offline operation |
| Telemetry | None — zero tracking or analytics |
| Free Forever | Always free to use; source is not distributed to prevent repackaging and resale |
Data Sources:
~/.claude/stats-cache.json— Token usage and model statistics (Claude Code's rolling 30-day window, updated periodically by Claude Code)~/.claude/analytics.db— SQLite database preserving your full usage history (managed by this extension)~/.claude/conversation-stats-cache.json— Personality and code stats (updated by backfill script)~/.claude/projects/*/— Conversation history for personality analysis and real-time today's cost~/.claude/.credentials.json— Subscription tier information (read-only). On macOS, credentials live in the system Keychain (serviceClaude Code-credentials) and are read via thesecurityCLI; macOS may prompt once to allow access.
Note: Today's stats may show $0.00 if Claude Code hasn't updated its cache yet. End your session or wait for the automatic cache update to see current data.
When you first install the extension, your "Local History" stats will only include data from Claude Code's cache file—typically the last ~30 days. This is because Claude Code maintains a rolling window and doesn't preserve older data.
Once installed, the extension automatically saves your usage data to a local SQLite database (~/.claude/analytics.db). From this point forward, your history is preserved forever—even as Claude Code's cache rolls over.
Over time, your "Local History" totals will grow to include months or years of usage data.
Use the "Claude Analytics: Clear History Before Date" command to remove old data:
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Type "Claude Analytics: Clear History"
- Select a cutoff date
- Confirm deletion
This is useful if you want to reset your stats or remove data from a specific period.
Want to import your full Claude.ai conversation history? You can backfill data from a Claude.ai data export:
- Export your data from claude.ai (Settings > Account > Export Data)
- Extract the downloaded ZIP file
- Run the included Python script:
python backfill_claude_export.py "path/to/data-export-folder"This imports:
- Daily message counts and estimated token usage
- Estimated API-equivalent costs
- Code blocks and lines of code (with language breakdown)
- Personality analysis (questions, please/thanks, etc.)
- Activity patterns (peak hours, night owl/early bird scores)
- Claude thinking time analytics
- User active time estimates
Why backfill? The extension can only track code blocks and personality stats from the day you install it. Running the backfill script imports your complete history from Claude.ai, giving you accurate lifetime statistics.
See the backfill section in the extension's dashboard for detailed instructions.
Import usage data from any external AI tool into your analytics dashboard. Create a JSON file at ~/.claude/external-additions.json:
{
"source": "copilot-cli",
"lastUpdated": "2026-04-09T12:00:00Z",
"rows": [
{ "date": "2026-04-01", "cost": 1.23, "messages": 15, "tokens": 50000, "sessions": 3 }
],
"modelRows": [
{
"date": "2026-04-01",
"model": "claude-sonnet-4-6",
"input_tokens": 30000,
"output_tokens": 10000,
"cache_read_tokens": 8000,
"cache_write_tokens": 2000
}
]
}External data merges seamlessly into all dashboard views, streaks, and lifetime totals. The JSON file is the source of truth and is re-loaded on every VS Code restart.
| Field | Required | Description |
|---|---|---|
source |
Yes | Identifier for the data source (e.g., "copilot-cli") |
rows |
Yes | Daily aggregate usage data |
modelRows |
No | Per-model token breakdown for accurate cost calculation |
Sync your analytics data across multiple machines using GitHub Gist.
-
Create a GitHub Personal Access Token:
- Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
- Click "Generate new token (classic)"
- Give it a descriptive name like "Claude Analytics Backup"
- Select the
gistscope (allows creating and updating Gists) - Click "Generate token" and copy it immediately
-
Configure the Extension:
- Open VS Code Settings (
Ctrl+,orCmd+,) - Search for "Claude Usage Gist"
- Enable
Gist Sync: Enabled - Paste your token in
Gist Sync: Token - (Optional) Set a specific Gist ID if syncing to an existing Gist
- Open VS Code Settings (
-
Sync Options:
- Auto-sync: Enabled by default when Gist sync is enabled - automatically syncs on each data update
- Manual sync: Run "Claude Analytics: Sync to Gist" command from Command Palette
- Import: Run "Claude Analytics: Import from Gist" to restore data from a backup
- Set up Gist sync on your primary machine (this creates the Gist automatically)
- Open VS Code Settings and copy the
Gist Sync: Gist Idvalue - On secondary machines:
- Configure with the same token
- Paste the Gist ID
- Run "Claude Analytics: Import from Gist" to sync historical data
- Your token is stored in VS Code user settings (not workspace settings)
- Gists are created as private by default
- The database contains only usage statistics - no conversation content
- Never share your Personal Access Token
Search for "Claude Usage Analytics" in the VS Code Extensions panel, or install via command line:
code --install-extension analyticendeavors.claude-usage-analyticsDownload the latest .vsix from the Releases page and install manually:
code --install-extension claude-usage-analytics-1.1.14.vsix| Requirement | Details |
|---|---|
| VS Code | Version 1.95.0 or higher |
| Claude Code CLI | Must be installed and authenticated |
| Operating System | Windows 10/11, macOS, or Linux |
| Node.js | v18+ (included with VS Code) |
- Install Claude Code CLI: Follow Anthropic's installation guide
- Authenticate: Run
claude auth loginto authenticate - Verify: Run
claude --versionto confirm installation
The extension adds widgets to your VS Code status bar:
- Left side: Cost, messages, tokens, personality, activity stats
- Right side: Subscription tier indicator
Click any widget to open the dashboard focused on the relevant tab. Each tooltip shows "Click to open [Tab Name]" for easy navigation.
| Shortcut | Action |
|---|---|
Ctrl+Alt+C |
Show Analytics Panel |
Ctrl+Alt+R |
Refresh All Data |
On macOS, use Cmd instead of Ctrl
Access via Ctrl+Shift+P (or Cmd+Shift+P on Mac):
| Command | Description |
|---|---|
Refresh Claude Usage |
Force refresh all statistics |
Scan Live Today Stats |
Scan JSONL files for real-time today's usage |
Show Claude Analytics Panel |
Open the dashboard |
Show Claude Analytics - Overview |
Jump to Overview tab |
Show Claude Analytics - Cost |
Jump to Cost tab |
Show Claude Analytics - Messages |
Jump to Messages tab |
Show Claude Analytics - Personality |
Jump to Personality tab |
Export Claude Usage Data |
Export usage data to JSON or CSV |
Claude Analytics: Clear History Before Date |
Delete historical data before a cutoff date |
Claude Analytics: Recalculate Historical Costs |
Rescan all JSONL files and rebuild database |
Claude Analytics: Sync to Gist |
Backup database to GitHub Gist |
Claude Analytics: Import from Gist |
Restore database from GitHub Gist |
Claude Analytics: Configure Gist Sync |
Open Gist sync settings |
claude-usage-analytics/
├── src/
│ ├── extension.ts # Extension entry point & command registration
│ ├── statusBar.ts # 7 status bar widgets with tooltips
│ ├── dashboardView.ts # 4-tab webview dashboard
│ ├── dataProvider.ts # Stats parsing, cost calculations & real-time today
│ ├── database.ts # SQLite persistence for historical data
│ └── limitsProvider.ts # Subscription tier from credentials
├── out/ # Compiled JavaScript
├── media/
│ ├── icon.png # Extension icon (128x128)
│ └── claude-icon.svg # Activity bar icon
└── package.json # Extension manifest & configuration
| Component | Responsibility |
|---|---|
| StatusBarManager | Creates and updates 7 status bar items with rich tooltips |
| DashboardViewProvider | Renders the 4-tab webview with real-time data |
| getUsageData() | Parses stats-cache.json and calculates all metrics |
| getTodayRealTimeUsage() | Reads JSONL files for accurate today's cost |
| getSubscriptionInfo() | Reads subscription tier from credentials (file on Linux/Windows, Keychain on macOS) |
Ensure Claude Code CLI is installed and you've used it at least once. The extension reads from ~/.claude/stats-cache.json which is created after your first Claude Code session.
Costs use model-specific pricing from modelPricing.json:
- Claude Fable 5 / Mythos 5: $10/1M input, $50/1M output, $12.50/1M cache write, $1.00/1M cache read
- Claude Opus 4.8 / 4.7 / 4.6 / 4.5: $5/1M input, $25/1M output, $6.25/1M cache write, $0.50/1M cache read
- Claude Opus 4.1 / 4 / 3: $15/1M input, $75/1M output, $18.75/1M cache write, $1.50/1M cache read
- Claude Sonnet 5: $2/1M input, $10/1M output, $2.50/1M cache write, $0.20/1M cache read (introductory pricing through 2026-08-31; $3/$15 thereafter)
- Claude Sonnet 4.6 and earlier: $3/1M input, $15/1M output, $3.75/1M cache write, $0.30/1M cache read
- Claude Haiku 4.5: $1/1M input, $5/1M output, $1.25/1M cache write, $0.10/1M cache read
- Claude Haiku 3.5: $0.80/1M input, $4/1M output, $1/1M cache write, $0.08/1M cache read
- Claude Haiku 3: $0.25/1M input, $1.25/1M output
modelPricing.json stores the base input/output rates; cache rates are derived from the input rate (1.25x for cache writes, 0.1x for cache reads).
Today's cost is calculated in real-time from conversation files for maximum accuracy.
Claude Code credentials may not be found. Ensure you're authenticated with claude auth login. On macOS, credentials are stored in the system Keychain — the first read may trigger a one-time Keychain access prompt; choose "Always Allow" so the widget can update without further prompts.
- Automatic: Every 15 minutes by default. Configurable via the
claudeUsage.refreshIntervalSecondssetting (0 = disabled, 10–3600 seconds). - Manual: Click refresh button or press
Ctrl+Alt+R
The extension calculates today's cost in real-time from your local Claude Code conversation JSONL files (~/.claude/projects/), so this should rarely happen on 1.1.11+. If it does, click the refresh button or run "Scan Live Today Stats" from the command palette to force a fresh scan.
If today's cost is still empty after a manual scan, your ~/.claude/projects/ directory may be missing or the JSONL files weren't written for that session. Verify with ls ~/.claude/projects/ (or dir %USERPROFILE%\.claude\projects on Windows).
Token counts and message stats in the Account Total view rely on Claude Code's stats-cache.json, which Claude Code updates periodically rather than in real-time. The pie chart and streak supplement automatically from the live scan and SQLite history, so newly-released models and recent days show up even when that cache is stale.
No. All analysis happens locally. There are no network calls — the extension operates fully offline.
No. This extension specifically reads Claude Code's local statistics files. It's designed as a companion tool for Claude Code users.
- Verify Claude Code is installed:
claude --version - Check authentication:
claude auth status - Confirm stats file exists:
ls ~/.claude/stats-cache.json - Try using Claude Code once to generate initial data
- Re-authenticate:
claude auth login - Restart VS Code
- Check credentials file exists:
ls ~/.claude/.credentials.json(on macOS, runsecurity find-generic-password -s "Claude Code-credentials"instead — credentials live in the Keychain)
- Try the refresh command:
Ctrl+Alt+R - Reload VS Code window:
Ctrl+Shift+P> "Reload Window" - Check for extension errors in Developer Tools:
Ctrl+Shift+I
Personality analysis requires conversation history in ~/.claude/projects/. If you recently cleared your history or are using a new machine, stats will rebuild over time.
This extension is free and always will be. Source code is not publicly distributed to prevent unauthorized repackaging and resale. If you'd like to report a bug or request a feature, please use the Issues page.
Full release history is in CHANGELOG.md. Latest highlights:
- Claude Sonnet 5 pricing added at $2/$10 per MTok (introductory pricing through 2026-08-31; $3/$15 thereafter), matched ahead of the generic Sonnet tier so it isn't overcosted at $3/$15.
- Claude Fable 5 / Mythos 5 pricing added at $10/$50 per MTok (verified against Anthropic docs); previously fell through to the default Sonnet rate, undercosting by more than 3x. Also added the non-dated
claude-haiku-4-5alias.
- Opus 4.8 pricing added at $5/$25 per MTok (verified against Anthropic docs); resolves to the new Opus tier in cost calculations.
- Opus 4.7 pricing added at $5/$25 per MTok (verified against Anthropic docs).
- Pie chart now shows newly-released models (e.g. Opus 4.7) immediately, even before Claude Code's
stats-cache.jsonrecords them. - Cache Savings stat now uses per-model rates instead of a flat Sonnet estimate — accurate for Opus-heavy users.
- Streak no longer breaks to 0 when
stats-cache.jsonis stale; supplemented from SQLite + live scan. - Today's cost populates immediately on dashboard open (was showing $0.00 until the 3-second scan fired).
- Scan completes in ~1s instead of 30s on large histories via JSONL mtime filter; "Scan failed" toasts gone.
- Accessibility (WCAG 2.1 AA): full ARIA tab pattern, screen-reader labels on charts, keyboard focus rings, and
prefers-reduced-motionsupport. - Model name version parsing: chart labels now show the actual model version (Opus 4.7, Sonnet 4.6, Haiku 3.5) instead of always saying "4.5".
- macOS subscription tier fix (#7): credentials now read from the system Keychain via the
securityCLI, with the on-disk.credentials.jsonas a fallback.
- External additions sidecar: import usage data from any external AI tool (Copilot CLI, Forge CLI, etc.) via
~/.claude/external-additions.json. - Pricing fixes: Haiku 3.5 reverted to correct $0.80/$4, Opus 4.5 corrected to $5/$25, missing Opus 4.1 and Sonnet 4.5 entries added.
MIT License with Commons Clause — see LICENSE for details.
Free to use, modify, and distribute. Commercial sale or resale prohibited.
Copyright (c) 2024-2026 Reid Havens / Analytic Endeavors
- Built with Claude Code
- Inspired by the need to understand AI-assisted development patterns
Built by Analytic Endeavors




