Zenodo — technical report (not peer-reviewed)
The Context Economy of Agentic LLM Sessions: Where the Money Actually Goes
Evgenii Arsentev · ARSENTEV.AI · ORCID 0000-0002-9120-7298 · 2026-09-10
Abstract
Corrected 2026-09-15 (version 1.1): version 1.0 priced Claude Fable 5 cache reads at $0.25 instead of $1.00 per million tokens, and priced every cache write at the 5-minute rate although the logs show mostly 1-hour writes. The dollar figures and cost shares below are recomputed with all writes at the 1-hour rate. Session-level figures are estimates, because the dataset does not record the model of each session.
A measurement of where token spend actually goes in agentic LLM coding sessions.
Agentic coding assistants are usually reasoned about as generators: the model writes code, and the code it writes is what you pay for. This report measures that assumption against a complete local log corpus of one practitioner's agentic work — 722 sessions, 150,902 model calls, 34.56 billion tokens — and finds it close to inverted.
Main findings.
• Under published per-token API list rates, 87.8% of modeled spend is context handling (re-reading cached conversation state and writing new state into the cache) and 12.2% is generation of new text. Re-reading context alone costs 4.59× as much as everything the models produced.
• Token counts are more extreme: 97.05% of billed tokens are cache reads, 2.57% cache writes, 0.38% output, 0.01% fresh input — roughly 256 tokens of cached context read back for every token generated.
• Cost is highly concentrated: 80% of the total falls on an estimated 21 of 722 sessions (2.9%), and sessions longer than 200 model calls — 8% of sessions — account for an estimated 92.8% of spend. Median session cost is about $2.30 (estimate), against a mean of $48.44.
• A derived measure, input amplification (total input tokens billed in a session divided by that session's peak context size), has a median of 23.7×, a 90th percentile of 125.1× and a maximum of 4,182× (n = 590 sessions of at least three model calls): the same working state is paid for dozens of times over the life of a session.
• Delegated sub-agent calls are 52% of all model calls, each carrying its own context and its own multiplier.
Method contribution. The report documents two non-obvious deduplication traps in streaming agent logs that change the answer by roughly a factor of two in each direction: one model call is written to disk as several records sharing a request identifier, input-side counters are repeated rather than incremental (a naive sum overstates total cost by 1.95×), and output_tokens is a cumulative snapshot of the stream rather than a per-record delta (so keeping the first record per request understates generation by about half). The correct reconstruction is an element-wise maximum over records grouped by requestId / message.id. Symlinked log directories are a further duplication hazard for per-file pipelines. The pipeline was implemented twice independently; the two totals agree to within 0.02%.
Limitations. This is a single-practitioner, single-toolchain case study rather than a sample of a population; it is observational, not experimental, so no causal claim is made about session policy or workflow changes. Dollar figures are a model applied to logs at today's list rates, not an invoice (the work ran under subscription plans). The observation window pools two different operating regimes across two machines. Long-context surcharges are not modeled, which biases the estimate downward in exactly the expensive tail. Only logs present on disk at collection time are included.
Data availability. An aggregated, de-identified dataset (runs_final.json, one record per session: hashed identifier, call counts, token counters by class, peak context, modeled cost) is published with the report, along with the four figures. It contains no session content — no prompts, model output, file paths, file contents, tool arguments, project identifiers or hostnames.
What the 2026-09-15 correction changed. Version 1.0 reported 83.5% context handling and 16.5% generation, a modeled total of $25,790, Claude Opus 5 at 60.5% and Claude Fable 5 at 25.3% of cost, re-reading at 3.42× all output, 80% of cost in 3.3% of sessions, and 92.2% of cost in sessions over 200 calls. With all cache writes at the 1-hour rate, these become 87.8% / 12.2%, $34,977, 49.9% and 37.8%, 4.59×, about 2.9% and about 92.8% (the last two are estimates). Logs before 15 August 2026 on one machine do not show how long cache writes were kept. If some of those writes were 5-minute writes, context handling lies between 86.2% and 87.8% of cost and the total between $30,794 and $34,977. Token counts, token composition, input amplification and the deduplication method are unchanged. Corrected report and recomputation scripts: version 1.1, DOI 10.5281/zenodo.22759216.
Keywords: large language models, agentic systems, AI coding agents, prompt caching, context window, cost analysis, token economics, telemetry, log analysis, software engineering economics, case study
Cite
@techreport{arsentev2026context,
author = {Arsentev, Evgenii},
title = {The Context Economy of Agentic LLM Sessions: Where the Money Actually Goes},
institution = {ARSENTEV.AI},
year = {2026},
doi = {10.5281/zenodo.22759216},
url = {https://doi.org/10.5281/zenodo.22759216}
}