Skip to main content

contexttax

Where your Claude Code usage actually goes.

Most of it isn't loops or re-reads. It's long conversations. Every turn sends the whole conversation again, so a session at 500k tokens pays for all of it on every message.

uvx contexttax

No install with uv. Or, with plain Python 3:

curl -fsSL https://raw.githubusercontent.com/theadamdanielsson/contexttax/main/contexttax.py | python3 -

What it shows

My last 27 days:

contexttax · Claude Code · last 27 days · 316 sessions · 8,188 model calls

  76% of your usage went to turns where the conversation was already over 200k tokens.
  Your biggest 10% of sessions used 90%. One session alone used 14%.
  A turn at 500k+ context costs 5.0x a turn at 50-100k.
  Median turn: 255k of context. One in ten: over 604k.

  Starting fresh with a short summary at 200k would have saved about 24%.

  What people usually blame:
    re-reading the same file     43 of 792 reads
    loops (same call 3 times)    1
    huge tool outputs            1%
    subagents                    5%
    cache rebuilt after a break  4%

  Where it goes: cache reads 70%, cache writes 20%, output 10%

Private by design

It reads the logs Claude Code already keeps in ~/.claude/projects. It prints numbers only. It sends nothing anywhere and writes nothing. One file, standard library only, so you can read all of it first.

How it counts

Usage is weighted by API prices, the closest public stand-in for how plan limits are counted. Per model: Opus 5, Sonnet 3, Haiku 1. Within a model: input 1, cache write 1.25 (5-minute) or 2 (1-hour), cache read 0.1, output 5. Plan limits aren't published, so treat the shares as close, not exact.

The fresh-start saving assumes each turn past 200k would instead carry a 20k summary. It ignores what a summary leaves out.

Options

contexttax --days 7     # last week
contexttax --days 0     # everything in the logs
contexttax --json       # the numbers as JSON

Share yours

If your numbers look different from mine, I'd like to see them. Open an issue with the output.

MIT licence.

Metadata

Release files for contexttax 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contexttax 0.1.0
File Size Uploaded Provenance Actions
contexttax-0.1.0.tar.gz 7.8 kB Without provenance Details for contexttax-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for contexttax 0.1.0
File Interpreter ABI Platform Actions
contexttax-0.1.0-py3-none-any.whl Python 3 none any Details for contexttax-0.1.0-py3-none-any.whl

Total release size: 15.4 kB

Release files / contexttax-0.1.0.tar.gz

Download URL contexttax-0.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
60c1e0179abfbe9c3f4a9c428f0b7ff92f019b0abdabe793d82d0c541d93490c
BLAKE2b-256 checksum
How to use checksums
bd8c0a4af4c3f197914100712018e4c4ac6fe7be3bf440345f3e9fd98341e230
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / contexttax-0.1.0-py3-none-any.whl

Download URL contexttax-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11a537918df92ace68379f78ea806f638d18250e5edbb0688edad76e7054b90b
BLAKE2b-256 checksum
How to use checksums
6f7b61e889216f46ed6c2e6d4698500340d5bbc7c4dd4e5c3457c0e103b0d3a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for contexttax 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page