[2604.22750] How Do AI Agents Spend Your Money? Analyzing and Predicting Token Consumption in Agentic Coding Tasks
Abstract:The wide adoption of AI agents in complex human workflows is driving rapid growth in LLM token consumption. When agents are deployed on tasks that require a significant amount of tokens, three questions naturally arise: (1) Where do AI agents spend the tokens? (2) Which models are more token-efficient? and (3) Can agents predict their token usage before task execution? In this paper, we present the first systematic study of token consumption patterns in agentic coding tasks. We analyze trajectories from eight frontier LLMs on SWE-bench Verified and evaluate models' ability to predict their own token costs before task execution. We find that: (1) agentic tasks are uniquely expensive, consuming 1000x more tokens than code reasoning and code chat, with input tokens rather than output tokens driving the overall cost; (2) token usage is highly variable and inherently stochastic: runs on the same task can differ by up to 30x in total tokens, and higher token usage does not translate into higher accuracy; instead, accuracy often peaks at intermediate cost and saturates at higher costs; (3) models vary substantially in token efficiency: on the same tasks, Kimi-K2 and Claude-Sonnet-4.5, on average, consume over 1.5 million more tokens than GPT-5; (4) task difficulty rated by human experts only weakly aligns with actual token costs, revealing a fundamental gap between human-perceived complexity and the computational effort agents actually expend; and (5) frontier models fail to accurately predict their own token usage (with weak-to-moderate correlations, up to 0.39) and systematically underestimate real token costs. Our study offers new insights into the economics of AI agents and can inspire future research in this direction.
How Do AI Agents Spend Your Money? Analyzing and Pre- dicting Token Consumption in Agentic Coding Tasks Longju Bai1 Zhemin Huang2,5 Xingyao Wang3 Jiao Sun4 Rada Mihalcea1 Erik Brynjolfsson2 Alex Pentland2,6 Jiaxin Pei2 ∗ 1 University of Michigan 2 Stanford University 3 All Hands AI 4 Google Deepmind…
saved by
related reading
- [2510.13786] The Art of Scaling Reinforcement Learning Compute for LLMsarxiv.org
- [2607.00053] SWE-Router: Routing in Multi-turn Agentic Software Engineering Tasksarxiv.org
- Cheap RL tasks will waste compute | Mechanize, Inc.mechanize.work
- [2607.14345] Value Leakage: An LLM's Answers Are Silently Shaped by Its Own Valuesarxiv.org
- Expenditure Horizon: Measuring Optimization Ability, with an Application to NanoGPTmetr.org
- Agent Evaluation: A Detailed Guidecameronrwolfe.substack.com
- Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscationarxiv.org
- Inference economics of language modelsarxiv.org
- [2410.00079] Interactive Speculative Planning: Enhance Agent Efficiency through Co-design of System and User Interfacearxiv.org
- [2602.11865] Intelligent AI Delegationarxiv.org
- [2605.06546] Efficient Pre-Training with Token Superpositionarxiv.org
- [2409.19759] Balancing Cost and Effectiveness of Synthetic Data Generation Strategies for LLMsarxiv.org