Skip to content
devprohacks.in

Docs

Export your usage

Pick your tool, run one command or click one button, then paste the result on the home page. Everything is read in your browser.

Your raw logs

The fastest way: run npx tokenreceipt in a terminal (Node 18+). It reads the logs your coding agents already keep, prints a summary and, with --open, opens your report here. It lists every file it opened and uploads nothing.

Or drop the files on the home page; you can select a whole folder's worth at once:

  • Claude Code: ~/.claude/projects/**/*.jsonl (or ~/.config/claude/projects). Claude Code deletes these after 30 days by default.
  • Codex CLI: ~/.codex/sessions/**/*.jsonl. Compressed .jsonl.zst files need the command-line tool.
  • OpenCode: ~/.local/share/opencode/storage/message/**/*.json. Newer versions keep a SQLite database instead, which only the command-line tool can read.

ccusage JSON

ccusage reads your local coding-agent logs (Claude Code, Codex, OpenCode, Gemini CLI and others) and prints token counts. It runs on your machine. We are not affiliated with it.

# daily (best default)
npx ccusage@latest daily --json

# one row per month, or per session
npx ccusage@latest monthly --json
npx ccusage@latest session --json

# 5-hour blocks
npx ccusage@latest blocks --json

# a date range, and a per-model split
npx ccusage@latest daily --json --since 20261001 --until 20261018 --breakdown

# straight to your clipboard (macOS / Linux with xclip)
npx ccusage@latest daily --json | pbcopy
npx ccusage@latest daily --json | xclip -selection clipboard

We accept daily, weekly, monthly, session and blocks reports, the older {type, data, summary} shape, --instances project grouping and --sections (we use the first section only, so nothing is counted twice). Rows that list several models without a breakdown are priced at the cost ccusage reported; add --breakdown for a per-model split.

Claude Code /cost (beta)

Inside a Claude Code session, type /cost and copy the whole block, including the Usage by model lines. It covers one session only and its numbers are rounded (for example 1.2k), so treat the receipt as rough. For a month of history, use ccusage instead.

Total cost:            $4.21
Usage by model:
   claude-sonnet-5-5:  24.1k input, 139.2k output, 11.2m cache read, 645.5k cache write ($4.20)

Cursor usage CSV

  1. Open the Cursor dashboard and go to Usage.
  2. Pick a date range and click Export CSV.
  3. Drop the file on the home page.

We read Model, Input (w/o Cache Write), Input (w/ Cache Write) (which is the cache-write count), Cache Read and Output Tokens, and skip rows marked Errored or Aborted. Rows marked Included or Free cost you nothing extra on your plan; the receipt shows what those tokens would cost at API list prices, and separately shows the real usage-based charges in your file. Cursor model names like auto can't be priced automatically; pick a model for them in the Data check panel.

Anthropic Console usage CSV (beta)

  1. In the Claude Console, open Usage (not Cost) in the left nav.
  2. Set the date range and filters, then click Export.

We expect columns like Model, Input Tokens, Output Tokens, Cache Read Tokens, Cache Write 5m Tokens, Cache Write 1h Tokens. The Cost export only has dollar amounts, no token counts, so it can't be re-priced. Column names are matched from Anthropic's documented report shape; any column we don't use is listed, never guessed.

OpenAI usage CSV (beta)

  1. Open the OpenAI platform Usage dashboard.
  2. Choose the period and use Export (see OpenAI's help article).

We read model, input_tokens, output_tokens and input_cached_tokens. OpenAI counts cached tokens inside input_tokens, so we split them out and price them at the cached rate.

Manual entry

Switch to Manual, pick the model you used, and type token counts. 1200, 350k, 2.5M and 1.2B all work. Most dashboards show these four numbers somewhere.

How the math works

  • Baseline: each model in your export is matched to a row in our price table and priced at its list price: input, output, cache read and cache write, per million tokens.
  • Comparisons: the same token totals are priced at each comparison model's list price. Where a model has no separate cache rate, we price those tokens at its input rate rather than at zero.
  • Unknown models are left off the receipt and flagged. ccusage's own cost is used only for rows it priced itself.
  • Not included: batch or off-peak discounts, long-context surcharges, taxes, regional uplifts, and tokenizer differences (other models may count the same text differently).

That's why every number says "estimate" and "could cost about".

FAQ

Is my usage uploaded?
No. Files you drop are read by JavaScript in your tab. A report link from npx tokenreceipt keeps the summary after the # in the link, which browsers never send to a server.
Why do I get a range, not one number?
Your next month won't be identical to the last one. We resample your own days to get a likely range (10th to 90th percentile) and widen it when there are fewer than 7 active days. Savings are ranges for the same reason.
Where do the prices come from?
LiteLLM and models.dev (both open, MIT) every day, checked against the vendors' own pricing pages. Every row shows its source and date on the price index.
Does the web report match the terminal exactly?
Totals do. Session flags on the web are computed from the summary in the link (your 25 biggest sessions, each at its main model), so they can differ slightly from the terminal.
What is “other” in my report?
A summary holds at most 12 models. Past that, the smallest known models are merged as “other” and unknown names as “unknown”. Neither can be priced as a group, so they're left out of the dollar figures and the report says how much that was.
Do you send price alerts?
Not yet. You can opt in on the alerts page and we'll tell you when they start; nothing is sent until then.