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 26 days:

contexttax output: 76% of usage went to turns over 200k context; the biggest 10% of sessions used 90%

The fix

If most of your usage goes to long conversations, one setting changes it. Add this to ~/.claude/settings.json:

"autoCompactWindow": 200000

Claude Code then compacts at 200k instead of near the limit. Or use /autocompact to set it from a session. The trade-off: it summarises more often, so a very long task may lose some early detail. contexttax tells you when this applies to you, and when you've already set it.

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
contexttax --share      # a few lines to paste anywhere

Share yours

contexttax --share prints a few lines you can paste anywhere:

76% of my Claude Code usage went to turns where the conversation was already past 200k tokens.
My biggest 10% of sessions used 90%.
Re-reads, loops and huge tool outputs barely registered.
Find yours: uvx contexttax

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.2

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.2
File Size Uploaded Provenance Actions
contexttax-0.1.2.tar.gz 8.7 kB Without provenance Details for contexttax-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 17.0 kB

Release files / contexttax-0.1.2.tar.gz

Download URL contexttax-0.1.2.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a1dca879e4df3d961e819af4a9039c66efaa3efaa68d677eaf6d36d680a0eecc
BLAKE2b-256 checksum
How to use checksums
7341e2ef3c104704481c50f5d6d3fbcee53a2d8502e6ca8ec07e03d9b94faf82
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.2-py3-none-any.whl

Download URL contexttax-0.1.2-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be0241aa669d9929ad42340dbd3c60f3620c65519e468ce21f4c19850082557c
BLAKE2b-256 checksum
How to use checksums
e610e13422580d0658c623f5dbf6f3388cbbea4573c4d6b09bf19a42560e58dc
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.2

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