npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-code-usage-analytics

v1.0.2

Published

See where your Claude Code tokens go. One command, zero setup.

Downloads

297

Readme

Claude Analytics

See where your Claude Code tokens go. One command, zero setup.

Claude Analytics reads your local Claude Code session data and serves an interactive dashboard showing exactly where your tokens are being consumed.

Quick Start

npx claude-code-usage-analytics

That's it. Your browser opens with a full analytics dashboard.

Features

  • Usage Breakdown - Every conversation ranked by token consumption with per-message drilldowns
  • Smart Insights - Actionable tips personalized to your usage patterns (vague prompts, long sessions, model mismatches)
  • Cost Estimation - Approximate USD cost based on current Claude API pricing, broken down by model
  • Export to CSV - Download all session data as a CSV for analysis in Excel, Sheets, or any tool
  • Daily Charts - Visualize token usage over time with stacked bar charts (input vs output)
  • Model Comparison - Token split across Opus, Sonnet, and Haiku with donut chart
  • Project Analytics - Per-project breakdown with expandable drawers showing top prompts and tool usage
  • Most Expensive Prompts - Top 20 costliest individual messages ranked
  • Session Explorer - Sortable, searchable table of all conversations with click-to-drilldown
  • 100% Private - Everything runs locally. No data leaves your machine.

How It Works

  1. Claude Code stores session data in ~/.claude/projects/ as JSONL files
  2. Claude Analytics reads and parses these files locally
  3. A local Express server serves the dashboard at http://localhost:3456
  4. Your browser opens automatically with the full analytics view

Options

npx claude-code-usage-analytics                    # Default: opens on port 3456
npx claude-code-usage-analytics --port 8080        # Custom port
npx claude-code-usage-analytics --no-open          # Don't auto-open browser
npx claude-code-usage-analytics --help             # Show help

Project Structure

ClaudeAnalaytics/
├── homepage/              # Landing page (deployed on Vercel)
│   ├── index.html
│   ├── styles.css
│   └── app.js
├── src/                   # NPX tool
│   ├── index.js           # CLI entry point
│   ├── server.js          # Express API server
│   ├── parser.js          # Session parser + insight generation
│   └── public/            # Dashboard UI
│       ├── index.html
│       ├── styles.css
│       └── app.js
├── vercel.json            # Vercel deployment config
└── package.json

Dashboard Sections

| Section | What it shows | |---------|--------------| | Stats Cards | Total tokens, conversations, messages, output ratio | | Insights | Personalized warnings about vague prompts, long sessions, model waste | | Daily Chart | Stacked bar chart of input/output tokens per day | | Model Donut | Token distribution across Opus, Sonnet, Haiku | | Projects | Per-project usage with expandable prompt details | | Top Prompts | 20 most expensive individual prompts | | Sessions | Full sortable/searchable session table | | Drilldown | Click any session to see every message and its token cost |

Tech Stack

  • Backend: Node.js, Express
  • Frontend: Vanilla HTML/CSS/JS, Canvas charts
  • Theme: Dark mode with glassmorphism
  • Deployment: Vercel (landing page)

Privacy

All data stays on your machine. The tool reads ~/.claude/ locally and serves a dashboard on localhost. Nothing is sent to any external server.

License

MIT

Author

Made with love by Bishal