TokenMeter: A Method and Tool for Attributing Token Cost in AI-Assisted Coding Sessions

I built TokenMeter to figure out where token cost actually goes in a Claude Code session, broken down by prompt, by tool call, and by model, with prompt caching priced in properly (most tools ignore this and get the real cost wrong as a result). I ran it on about ten weeks of my own usage: 11,942 assistant turns across 1,154 prompts. A few things stood out. Cost is heavily concentrated, the top 10% of prompts account for about 45% of spend (Gini 0.61). Caching does most of the work: 95% of input context came from cache, cutting effective cost by about 85%, so counting nominal tokens overstates real cost roughly 6.5x. Tool calls weren't more expensive than plain generation, which surprised me. And one model, run on nearly every turn, accounted for 97.5% of the cost, more a default-setting effect than a small share of turns quietly driving the bill. Because the method only needs recorded token counts, not anything Claude Code-specific, it should carry over to other coding tools and to a study across multiple developers, that's the next step. This deposit has the paper, the scripts used for the analysis and figures, the anonymized dataset (token counts only, no code or prompt text), and the figures. The tool itself is at https://github.com/plumbgoat/tokenmeter.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-09-11
DOI
https://doi.org/10.5281/zenodo.22702803
Primary Topic
Advanced Malware Detection Techniques
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

TokenMeter: A Method and Tool for Attributing Token Cost in AI-Assisted Coding Sessions

Shweta Tyagi
Zenodo (CERN European Organization for Nuclear Research)
Advanced Malware Detection Techniques
preprint

TokenMeter: A Method and Tool for Attributing Token Cost in AI-Assisted Coding Sessions

Shweta Tyagi
preprint en

Abstract

I built TokenMeter to figure out where token cost actually goes in a Claude Code session, broken down by prompt, by tool call, and by model, with prompt caching priced in properly (most tools ignore this and get the real cost wrong as a result). I ran it on about ten weeks of my own usage: 11,942 assistant turns across 1,154 prompts. A few things stood out. Cost is heavily concentrated, the top 10% of prompts account for about 45% of spend (Gini 0.61). Caching does most of the work: 95% of input context came from cache, cutting effective cost by about 85%, so counting nominal tokens overstates real cost roughly 6.5x. Tool calls weren't more expensive than plain generation, which surprised me. And one model, run on nearly every turn, accounted for 97.5% of the cost, more a default-setting effect than a small share of turns quietly driving the bill. Because the method only needs recorded token counts, not anything Claude Code-specific, it should carry over to other coding tools and to a study across multiple developers, that's the next step. This deposit has the paper, the scripts used for the analysis and figures, the anonymized dataset (token counts only, no code or prompt text), and the figures. The tool itself is at https://github.com/plumbgoat/tokenmeter.

Zenodo (CERN European Organization for Nuclear Research)
Decent work and economic growth
Advanced Malware Detection Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.