What your Kimi Code use would cost on the API

One command adds up the tokens in your Kimi Code CLI logs and prices them at Moonshot's Kimi 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 kimi-spend.mjs https://github.com/shurikenharness/kimi-spend/releases/download/v1.0.0/kimi-spend.mjs && openssl dgst -sha256 -r kimi-spend.mjs | grep -q ^0a7adaa4134dd24debfdfa380063025aafb0100b861cdbf78c3813763083dd4f && node kimi-spend.mjs

It downloads kimi-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 kimi-spend.mjs https://github.com/shurikenharness/kimi-spend/releases/download/v1.0.0/kimi-spend.mjs
openssl dgst -sha256 -r kimi-spend.mjs
less kimi-spend.mjs
node kimi-spend.mjs

Windows

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

It downloads kimi-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/kimi-spend/releases/download/v1.0.0/kimi-spend.mjs" -OutFile kimi-spend.mjs
Get-FileHash kimi-spend.mjs
notepad kimi-spend.mjs
node kimi-spend.mjs

Or with npx (no checksum step):

npx github:shurikenharness/kimi-spend#v1.0.0

kimi-spend.mjs v1.0.0 · SHA-256 0a7adaa4134dd24debfdfa380063025aafb0100b861cdbf78c3813763083dd4f

Read the source on GitHub · Release v1.0.0

Nothing leaves your computer

It reads the usage logs Kimi Code keeps in ~/.kimi-code/sessions, 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, cache reads and writes, output
  • The time of each request
  • From config.toml, only the model names

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.

Kimi spend on this computer (API-equivalent estimate)

                      Cost    Tokens     Calls
Today                $2.37       22M        67
Last 7 days         $18.37      174M       522
Last 30 days        $50.96      482M     1,447
All time            $59.26      560M     1,683

By model, all time                    Cost   Input  Output  Cached    Calls
kimi-for-coding                     $38.20   18.4M    2.7M  104.3M    1,450
kimi-k3                             $21.06    3.1M  610.0K   20.9M      233

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 Kimi Code membership 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 usage rows Kimi Code writes to ~/.kimi-code/sessions after every request, and the older kimi-cli's in ~/.kimi/sessions. From config.toml it reads only the model names, never the provider keys. It never prints a prompt, a reply or a file path.

Does Kimi log enough to price it?

Kimi Code logs every request's model and tokens, so its numbers are complete. The older kimi-cli logged each step's tokens but not the model, so those steps are priced at the default model in its config.toml, or at the one you name with --model. Kimi Code's own model names are priced as the Kimi API model they run on.

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.

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