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

code-usage

v0.2.7

Published

Unified usage dashboard for AI coding tools (Claude Code, Codex CLI, OpenCode)

Readme

npx code-usage

See how much your AI coding actually costs — across all your tools, in one place.

code-usage reads local session files, calculates API-equivalent costs, and builds a self-contained HTML dashboard. No accounts, no APIs, no data leaves your machine.

Why code-usage?

Most usage trackers cover a single tool. If you use Claude Code and Codex and Amp, you need separate tools for each.

code-usage gives you one unified dashboard with combined views, stacked charts, and side-by-side comparisons — for every AI coding agent you use.

Supported Tools

| Tool | Status | |------|--------| | Claude Code | Supported | | Codex CLI | Supported | | OpenCode | Supported | | Amp | Supported | | Pi-Agent | Supported |

Only tools with local data appear in the dashboard — no empty tabs, no clutter.

Features

  • Combined + per-agent views — stacked charts showing cost breakdown across all your tools
  • Per-model costs — see exactly which models eat your budget (Opus 4.6 vs Sonnet 4.5 vs GPT-5.3)
  • Per-project breakdown — donut chart with cost/session data per project
  • Daily & weekly trends — spot patterns in your usage over time
  • Date range filtering — This Week, This Month, Last 30/90 Days, All Time
  • Dark mode — System / Light / Dark theme toggle, persisted across sessions
  • Token breakdown — input, output, cache read/write, reasoning tokens with tooltips
  • Usage streaks — see your consecutive days of AI coding activity
  • JSON export--json flag for scripting and automation
  • 100% offline — everything runs locally, nothing is uploaded

Quick Start

npx code-usage

Or install globally:

npm install -g code-usage

That's it. If you have session data from any supported tool, the dashboard opens automatically.

CLI Options

code-usage                  # Open dashboard in browser
code-usage --no-open        # Generate HTML without opening
code-usage --json           # Print structured JSON to stdout
code-usage --range 30d      # Filter: 7d, 30d, 90d, all
code-usage -v               # Version
code-usage -h               # Help

Output

~/.code-usage/current/code-usage-dashboard.html   # Interactive dashboard
~/.code-usage/current/openusage-data.json          # Raw data snapshot

How It Works

  1. Reads local session files from each tool's standard data directory
  2. Calculates token counts and API-equivalent cost estimates per model
  3. Aggregates by day, week, project, and model
  4. Builds a single self-contained HTML file with all data inlined
  5. Opens it in your browser

Pricing is based on published API rates. Fallback pricing powered by LiteLLM. If you're on a subscription plan (Claude Max, Codex Pro), actual billed cost may differ.

Privacy

All data stays on your machine. code-usage only reads standard local session files — no .env, no API keys, no network calls.

Development

npm install
npm run lint              # Biome
npm test                  # Vitest (53 tests)
npm run build:dashboard   # Rebuild template
node bin/code-usage.js    # Run locally

Links

License

MIT - Aman