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

v0.1.1

Published

Estimate your Claude Code historical usage cost on third-party API providers (DeepSeek, Qwen, Kimi, GLM)

Readme

claude-code-api-cost-estimator

Estimate your historical usage cost on third-party API providers (DeepSeek, Qwen, Kimi, or GLM)

Scans your local Claude Code sessions, buckets token usage to each provider's tiers, and calculates side-by-side cost comparison.

Comparison matrix screenshot

Quick start

npx claude-code-api-cost-estimator

The CLI starts a small local web server (default port 3000) and opens your browser to a comparison matrix.

If the browser doesn't open automatically (or you used --no-open), visit:

http://localhost:3000

Use a different port with --port:

npx claude-code-api-cost-estimator --port 4123
# then open http://localhost:4123

Stop the server with Ctrl+C in the terminal where it's running.

Requires Node.js 18 or newer.

If you'd rather clone and run:

git clone https://github.com/chrisjunlee/claude-code-api-cost-estimator
cd claude-code-api-cost-estimator
node bin/cli.mjs

Flags

| Flag | Default | Description | |---|---|---| | --port <n> | 3000 | Port to listen on | | --days <n> | 30 | Days of history to scan | | --projects-dir <path> | ~/.claude/projects | Where to find your .jsonl session files | | --no-open | (off) | Don't auto-open the browser | | -h, --help | | Show help |

Examples:

npx claude-code-api-cost-estimator --days 7
npx claude-code-api-cost-estimator --port 4123 --no-open
npx claude-code-api-cost-estimator --projects-dir /path/to/sessions

What it does

Claude Code stores every session as a JSONL file under ~/.claude/projects/. Each assistant line includes the model used and a usage block with input_tokens, output_tokens, cache_read_input_tokens, and cache-creation token counts.

This tool:

  1. Walks ~/.claude/projects/**/*.jsonl (last N days)
  2. Aggregates per-model token usage
  3. Multiplies tokens by prices from pricing.json
  4. Renders a side-by-side comparison: native Anthropic API cost vs. each third-party provider

The Anthropic API column is the baseline, not the point. The whole tool exists to put third-party numbers next to it so you can see the real delta on your workload, not a marketing chart.

Privacy

  • All scanning and computation runs on your machine
  • No transcripts, prompts, or token counts are sent anywhere
  • The local server only binds to localhost

Updating pricing

All prices live in pricing.json at the package root. Edit it and refresh the browser. The server re-reads the file on every request, no restart needed.

Per-model fields (models):

  • input / output: USD per 1M tokens
  • cache_read: USD per 1M cache-read tokens (falls back to input if omitted)
  • cache_write_5m / cache_write_1h: USD per 1M cache-write tokens (fall back to input)
  • tiers: array of { max_input_tokens, input, output } for banded pricing (e.g. Qwen3-Max)
  • tier: "premium" / "standard" / "fast" on Claude models; used for provider tier mapping
  • valid_until: ISO date; shows a banner on the page while active

Provider entries (providers) let one dropdown option map Claude tiers to different underlying SKUs:

"providers": {
  "deepseek-v4": {
    "displayName": "DeepSeek V4",
    "tierMap": { "premium": "deepseek-v4-pro", "standard": "deepseek-v4-flash", "fast": "deepseek-v4-flash" }
  }
}

altOrder can reference either a model key (flat single-SKU) or a provider key (tier-mapped).

Contributing

Pricing changes and new providers are very welcome. Open a PR editing pricing.json with a link to the provider's official pricing page.

Provider pricing references currently used:

| Provider | Pricing page | |------------|-------------| | Anthropic | https://www.anthropic.com/pricing | | DeepSeek | https://api-docs.deepseek.com/quick_start/pricing | | Alibaba | https://www.alibabacloud.com/help/en/model-studio/models | | Moonshot | https://platform.kimi.ai/docs/pricing/chat-k2 | | Zhipu Z.AI | https://docs.z.ai/guides/overview/pricing |

Caveats

  • Token counts come straight from Claude Code transcripts. Tokenizers differ across providers, so equivalent counts aren't perfectly equivalent.
  • Cache-hit rates will vary in practice; the comparison assumes the same cache behaviour across all providers.

License

MIT