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-usage-analytics

v0.1.0

Published

Local dashboard for Claude Code usage: tokens, activity, models, tools, agents and projects

Readme

Claude Code Usage Analytics

A local dashboard for your Claude Code history: tokens, activity, models, tools, agents and projects. Data is read directly from ~/.claude/projects/**/*.jsonl and never leaves your machine.

Unofficial community tool, not affiliated with or endorsed by Anthropic.

Features

  • KPIs: total tokens, conversations, active sessions, agent calls, cache hit rate.
  • Overview: tokens per day (input / output / cache write / cache read), activity heatmap, activity by hour.
  • Models & tools: tokens per model, subagent calls (Agent), top tools.
  • Projects: conversations and tokens per project, recent conversations.

Range: 7D / 30D / 90D / All. UI in English and Russian (toggle in the header).

Getting started

Requires Node.js ≥ 20.11.1.

npx claude-usage-analytics

or install globally:

npm install -g claude-usage-analytics
claude-usage-analytics      # http://127.0.0.1:3300, opens the browser

CLI options: -p, --port <port> (default 3300), --host <host> (default 127.0.0.1), --no-open, -h, --help.

The package ships only the prebuilt server, so installing it pulls no dependencies.

Development

git clone https://github.com/AlSovg/claude-usage-analytics.git
cd claude-usage-analytics
npm install
npm run dev        # http://localhost:3000
npm run build      # production build into .output
npm start          # run the build via the CLI

API

GET /api/analytics?range=7d|30d|90d|all (defaults to 30d; any other value → 400). A single endpoint returns all dashboard data; the response type is AnalyticsResponse in shared/types/analytics.ts.

How it's calculated

  • Tokens — sum of message.usage from assistant messages. <synthetic> responses (interrupted streams) are excluded.
  • Subagents — <session>/subagents/*.jsonl files count toward their parent session's tokens but not as separate conversations.
  • User messages — real ones only: no isMeta, and origin.kind === "human" when origin is present.
  • Dates and hours — in the machine's local time zone.
  • Cache — each file's parse result is kept in memory keyed by mtime + size, so repeat requests only re-read changed files. The first request after server start is slower.

Limitations

  • Claude Code deletes old transcripts itself (cleanupPeriodDays in ~/.claude/settings.json, 30 days by default), so the dashboard only sees what is still on disk.
  • The claude.ai data export can't be used for stats: it has no token or model data.
  • For "All", the heatmap is capped at the last 730 days (totals are unaffected).

Project structure

bin/cli.mjs                     CLI: starts the built server, opens the browser
server/api/analytics.get.ts     endpoint
server/utils/                   file scan, parser, cache, aggregation
shared/types/analytics.ts       types shared by client and server
app/pages/index.vue             dashboard page
app/components/analytics/       charts and widgets (Chart.js via vue-chartjs)
i18n/locales/                   ru / en translations