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-cost

v0.6.1

Published

Cost dashboard for Claude Code usage

Readme

Claude Code Cost

npm version license npm downloads

Know what Claude Code costs you — per day, per project, per session.

Getting Started

npx claude-code-cost --open

Open http://localhost:3458 (or use --open to auto-launch the browser).

That's it. No hooks, no config — the dashboard reads your existing Claude Code session files.

Overview

Overview — Dark Overview — Light

Projects

Projects — Dark Projects — Light

Session Detail

Session — Dark Session — Light

Features

  • Top-down drill-down — Total cost → per project → per session → per message
  • Dynamic pricing — Fetches live model prices from LiteLLM, supports tiered pricing (200K threshold), cache token costs, and fast mode multipliers
  • Daily cost chart — Bar chart with cumulative line, configurable date range (1d / 3d / 7d / 30d / 90d / 1y)
  • Model distribution — Donut chart showing cost breakdown by model
  • Cache efficiency — Track how well prompt caching is working across your sessions
  • Project breakdown — See which projects cost the most, sortable by cost, sessions, or activity
  • Session detail — Message-level cost breakdown with cumulative cost and token stacked bar charts
  • Dark & light theme — Matches the Claude Code Hub design system
  • Hub integration — Works as a tab in Claude Code Hub alongside Kanban and Marketplace
  • Instant reload — API responses cached in browser; Refresh button for fresh data

Configuration

PORT=8080 npx claude-code-cost              # Custom port
npx claude-code-cost --open                 # Auto-open browser
npx claude-code-cost --dir=~/.claude-work   # Custom Claude config dir

If port 3458 is in use, the server falls back to a random available port.

Global install

npm install -g claude-code-cost
claude-code-cost --open

How It Works

Claude Code writes conversation logs to ~/.claude/projects/ as JSONL files. Each assistant response includes token counts (input_tokens, output_tokens, cache_creation_input_tokens, cache_read_input_tokens) and model info.

The dashboard:

  1. Reads JSONL session files (streamed line-by-line for large files)
  2. Fetches live model pricing from LiteLLM (cached 6h, offline fallback included)
  3. Calculates cost per message using tiered pricing with 200K token threshold
  4. Aggregates by day, project, and session — all server-side
  5. Renders with Chart.js — no build step, vanilla JS

Nothing is modified — the dashboard is read-only.

Cost Calculation

Uses the same pricing logic as ccusage:

  • Auto mode — Uses pre-calculated costUSD from JSONL when available, otherwise calculates from tokens
  • Tiered pricing — Tokens above 200K threshold charged at higher rate (Claude 1M context models)
  • Fast mode — Applies provider-specific multiplier for fast/streaming responses
  • Deduplication — Skips duplicate messages by messageId + requestId hash

FAQ

Where does pricing data come from? Live from LiteLLM's pricing dataset (2000+ models). Cached for 6 hours. If the fetch fails, a bundled offline snapshot of Claude model prices is used.

Does it work offline? Yes. The offline pricing fallback covers all current Claude models. PWA support included.

Does it modify any files? No. Completely read-only — only reads JSONL files from ~/.claude/projects/.

Does it work with Claude Code Hub? Yes. Exposes /hub-config endpoint and forwards keyboard shortcuts (Ctrl+Alt+Arrow, Alt+1-9) to the hub parent frame.

License

MIT