claude-calc
See what your Claude Code sessions would cost at pay-per-token API rates.
It reads the session logs Claude Code keeps in ~/.claude/projects, prices
every API message, and shows the result in a local dashboard:
- spend over time, with a run-rate forecast for the current month
- cost per model, split into output / cache reads / cache writes / input
- efficiency: cache hit rate, cost per prompt, context size per message, and how many messages ran with more than 150k tokens of context
- a weekday-by-hour heatmap of when you spend
- projects you can expand down to individual sessions, each with its first prompt, prompt count, peak context, and cost per prompt
Install
pipx install claude-calc
or pip install claude-calc. Python 3.9 or newer, no other dependencies.
Use
claude-calc
Starts the dashboard on http://localhost:8765 and opens it in your browser. Logs are rescanned on every page load and on the Rescan button.
claude-calc report
Prints a plain-text summary instead.
Options:
| Flag | Meaning |
|---|---|
--port 9000 |
serve on a different port |
--no-browser |
don't open a browser tab |
--projects-dir DIR |
read logs from somewhere other than ~/.claude/projects |
Pricing
Rates are $/MTok in PRICES inside claude_calc/costlib.py, as
(input, output, cache_read, cache_write_5m, cache_write_1h). Messages are
deduplicated by API message id, and cache writes are billed at the 5-minute
or 1-hour rate depending on which the message used. Models with no rate are
skipped and listed at the bottom of the page.
Develop
git clone https://github.com/hibrahem/claude-calc
cd claude-calc
python3 -m claude_calc.cli
Releases publish to PyPI from GitHub Actions when a v* tag is pushed.
Release files for claude-calc 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| claude_calc-0.2.0.tar.gz | 88.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| claude_calc-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 178.2 kB
Release files / claude_calc-0.2.0.tar.gz
| Download URL | claude_calc-0.2.0.tar.gz |
|---|---|
| Size | 88.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3ce29c072dee9f428d129e2d9a26b588c16802df62d2e059901af57537e1dfa
|
|
BLAKE2b-256 checksum How to use checksums |
fc43395038166cf9a32d5cab116230990ac594a62c51de7878b75791af5a2a5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logRelease files / claude_calc-0.2.0-py3-none-any.whl
| Download URL | claude_calc-0.2.0-py3-none-any.whl |
|---|---|
| Size | 89.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
665e3d9fae253c974398cc707f854913321db215002e6d319831ff8125a04517
|
|
BLAKE2b-256 checksum How to use checksums |
c70b45d41855ca7375b383cc50791eb0381c29c7b8f4a035686381b0a0599140
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency log