What your Claude Code use would cost on the API

One command adds up the tokens in your Claude Code logs and prices them at Anthropic's API list prices: today, the last 7 and 30 days, all time, and by model.

Run this in a terminal

macOS and Linux

curl -fsSLo claude-code-spend.mjs https://github.com/shurikenharness/claude-code-spend/releases/download/v1.0.0/claude-code-spend.mjs && openssl dgst -sha256 -r claude-code-spend.mjs | grep -q ^b6622addf86963340de95beab21868a6165843290a8e8836d9b63bdfeae812ca && node claude-code-spend.mjs

It downloads claude-code-spend.mjs v1.0.0 from GitHub and runs it with Node.js 18 or later, only if its SHA-256 matches.

Read it first

Download the file, check that its SHA-256 is the one in the command above, read it, then run it:

curl -fsSLo claude-code-spend.mjs https://github.com/shurikenharness/claude-code-spend/releases/download/v1.0.0/claude-code-spend.mjs
openssl dgst -sha256 -r claude-code-spend.mjs
less claude-code-spend.mjs
node claude-code-spend.mjs

Windows

irm "https://github.com/shurikenharness/claude-code-spend/releases/download/v1.0.0/claude-code-spend.mjs" -OutFile claude-code-spend.mjs; if ((Get-FileHash claude-code-spend.mjs).Hash -eq 'b6622addf86963340de95beab21868a6165843290a8e8836d9b63bdfeae812ca') { node claude-code-spend.mjs } else { 'claude-code-spend.mjs does not match its SHA-256, so it was not run.' }

It downloads claude-code-spend.mjs v1.0.0 from GitHub and runs it with Node.js 18 or later, only if its SHA-256 matches.

Read it first

Download the file, check that its SHA-256 is the one in the command above, read it, then run it:

irm "https://github.com/shurikenharness/claude-code-spend/releases/download/v1.0.0/claude-code-spend.mjs" -OutFile claude-code-spend.mjs
Get-FileHash claude-code-spend.mjs
notepad claude-code-spend.mjs
node claude-code-spend.mjs

Or with npx (no checksum step):

npx github:shurikenharness/claude-code-spend#v1.0.0

claude-code-spend.mjs v1.0.0 · SHA-256 b6622addf86963340de95beab21868a6165843290a8e8836d9b63bdfeae812ca

Read the source on GitHub · Release v1.0.0

Nothing leaves your computer

It reads the transcripts Claude Code keeps in ~/.claude/projects, prints the totals and exits. It makes no network calls, uploads nothing and writes no files.

Several accounts? Shuriken tracks them all. See how

What it reads

  • Model names and token counts: input, output, cache reads and writes
  • The time of each model call
  • Fast mode, US-only inference and web searches, which change the price

What it never shows

  • Your prompts or the replies
  • File paths, folder names or project names
  • Tool calls, code or command output
  • Your sign-in, API keys or settings

What it prints

Made-up numbers. Yours come from your own logs.

Claude Code spend on this computer (API-equivalent estimate)

                      Cost    Tokens     Calls
Today               $20.50       22M       137
Last 7 days        $158.88      174M     1,058
Last 30 days       $440.76      482M     2,936
All time           $512.51      560M     3,414

By model, all time                    Cost   Input  Output  Cached    Calls
claude-opus-5-5                    $412.08    2.1M    3.4M  310.2M    1,904
claude-sonnet-5                     $96.31    1.2M    1.9M  140.8M    1,122
claude-haiku-4-5-20251001            $4.12  410.0K  220.5K   12.0M      388

Several accounts? Shuriken tracks them all → shuriken.sh

Questions

Is this what I paid?

No. It is what the same tokens would cost at the API list prices. A Pro or Max plan has a fixed monthly price, so the number shows how much work went through it, priced as if you had paid per token.

What does it read?

The transcripts Claude Code writes to ~/.claude/projects (or every folder in CLAUDE_CONFIG_DIR, or the one you name with --dir). From each model call it keeps the model name, the token counts and the time. It never prints a prompt, a reply, a file path or a project name.

What does it send?

Nothing. It reads the files on your computer, prints the totals and exits. It makes no network calls, uploads nothing and writes no files; the tests check its source for all three.

Which prices does it use?

Anthropic's API list prices on the date printed under the totals, with cache reads, 5-minute and 1-hour cache writes, fast mode, US-only inference and web searches. A request written as several rows is counted once.

I use several accounts. Does it count them all?

It reads the logs on this computer, which belong to the account you use here. Shuriken tracks the usage and limits of all your accounts and API keys in one place.

Provided by Shuriken