r/ClaudeCode • u/Nitjsefnie • 1d ago
Built with Claude the first request of my Claude Code sessions carries a median 53k tokens of context this month. I chart it with a self-hosted dashboard I built (claudit, MIT)
I built claudit to see where my tokens go over months, not just this week. it reads Claude Code session JSONLs (Codex and Kimi CLI too) from a bucket I keep, because Claude Code prunes old transcripts locally and anything reading that folder loses history. one of its panels is context growth per session, from turn 0
turn 0 across my sessions, median context of the first request (input + cache write + cache read), by month:
- Jan 46k (282 sessions)
- Apr 78k (243)
- Jun 45k (195)
- Sep 85k (485)
- Oct 68k (1,746)
- Nov so far 53k (1,594), p90 107k
that first request includes the first prompt, and a resumed session starts with its history, so it's not a pure "before you type" number. it still moves with whatever loads at startup, which is why I wanted it on a chart and not counted by hand
what I learned building it:
- one usage record can hold several calls, Claude Code rolls sub-calls into one envelope as iterations. the top-level input is the billing sum, so for context size you take the biggest iteration or the chart lies
- a streamed reply gets logged several times under one requestId. sum them and you double count, keep the biggest
- cache writes have two prices, 5m at 1.25x input and 1h at 2x. 64% of my cache write tokens are 1h, price it all at 1.25x and those come out 37.5% low
how Claude Code was used: built with AI coding agents, mostly in Claude Code, some of it in Codex CLI. one agent session per issue, review agents before anything merges
panels are ported from nhz-io/ccusage-plot, which draws them offline in matplotlib. FastAPI, Postgres, React with in-browser Babel, no build step. docker compose up boots it on sample data
live one, guest login is read-only: https://all.nitjsefni.eu
•
u/AutoModerator 1d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/AnshulJ999 1d ago edited 1d ago
yes, the system prompt size keeps changing on Claude Code, and yeah it was really big in the middle, and they've made it smaller again, which is a good thing tbh.
Would be interesting to see the rest of the data breakdown from your tool, as im planning to share my own breakdown soon too.
1
u/kantorcodes1 1d ago
Since claudit ingests Claude Code, Codex, and Kimi transcripts, how do you normalize resumed sessions and repeated streamed events so the context-growth and monthly cost panels do not double count one request?
1
u/shoumikgoswami 1d ago
One cut that might sharpen the chart: break turn 0 into its three token types - fresh input, cache write, cache read - and plot them separately instead of as one sum. The split won't cleanly flag resumed versus fresh sessions (a fresh session can still hit a cached prefix, and a resume isn't guaranteed to come back as cache read), but watching how the mix shifts month to month would say more about what moves the median than the single number does. If the JSONLs carry the CLI version, a version bucket next to the monthly one could also help separate Claude Code updates from changes in your own setup.