Key figures
TL;DR- 50xmore tokens consumed by a typical agentic coding session than a comparable code-chat exchange, driven by full-context replay on every turnVantage, 'The Hidden Cost Driver in Agentic Coding Sessions in 2026', vantage.sh/blog/agentic-coding-costs
- ~1Minput tokens consumed by a typical 50-turn agentic session, with a 25:1 input-to-output ratioVantage, 'The Hidden Cost Driver in Agentic Coding Sessions in 2026', vantage.sh/blog/agentic-coding-costs
- ~52%cost reduction from simple observation masking vs. raw agent baseline, with no solve-rate loss on SWE-bench VerifiedLindenbauer et al., 'The Complexity Trap', arXiv:2508.21433 (NeurIPS DL4Code 2025)
- $1.3MOpenAI API bill in a single month from 100 Codex agents running autonomously (603 billion tokens, 7.6 million requests)Tom's Hardware / TheNextWeb, reporting on Peter Steinberger / OpenClaw (May 2026)
Overview
Agentic coding — giving an LLM a task and letting it iterate autonomously through tools, file reads, test runs, and error recovery — consumes tokens at a scale that catches most teams off guard. The mechanic is simple: every API call replays the full conversation history as input. A 50-turn session accumulates context the way a stack trace does; the bill compounds accordingly. This page collects real, publicly documented numbers on what that costs, which models are most efficient on rigorous benchmarks, and where the tokens actually go.Why agents cost so much more than chat
In a one-shot code query, input tokens are roughly equal to the prompt. In an agentic session the model is handed its entire history — system prompt, every file excerpt it read, every tool output, every diff — re-encoded as input on every single turn. Vantage's analysis of agentic coding sessions puts a concrete number on this: a typical 50-turn session consumes roughly 1 million input tokens and 40,000 output tokens — a 25:1 input-to-output ratio. By turn 30 the model is already carrying 25,000–35,000 tokens of accumulated context on each request. This means:- Input price, not output price, drives the bill.
- A 10x price difference between models applies on every single turn as context grows.
- Prompt caching (Anthropic charges approximately 10% of base input for cache reads) is the single highest-leverage cost lever available today.
Model pricing reference (June 2026)
All figures from Anthropic's official pricing page:| Model | Input ($/MTok) | Output ($/MTok) | Cache read |
|---|---|---|---|
| Claude Opus 4.8 | $5.00 | $25.00 | approx. $0.50 |
| Claude Sonnet 4.6 | $3.00 | $15.00 | approx. $0.30 |
| Claude Haiku 4.5 | $1.00 | $5.00 | approx. $0.10 |
Benchmark: cost vs. accuracy on SWE-bench Verified
SWE-bench Verified is the standard rigorous benchmark for coding agents: 500 real GitHub issues, human-reviewed to confirm they are solvable and have unambiguous acceptance criteria. The leaderboard tracks pass rate and, for many entries, approximate cost per task. Key data points as of June 2026:- Claude Haiku 4.5 achieves 35.9% on Verified in lightweight scaffolds — an unusually strong pass-rate-per-dollar given its $1/$5 pricing. This makes it the model most teams should evaluate before paying for heavier compute.
- Claude Sonnet 4.6 scores around 77%, roughly five percentage points ahead of Haiku 4.5 in heavier setups, at 3x the input price.
- Context accumulates quadratically as conversation history grows: each model call re-sends the full prior context, so cost rises non-linearly with session depth regardless of model.
Research: where the tokens go
arXiv:2601.14470 — "Tokenomics: Quantifying Where Tokens Are Used in Agentic Software Engineering" (January 2026, arxiv.org/abs/2601.14470) analysed 30 SDLC tasks run through the ChatDev multi-agent framework on a GPT-5 reasoning model. Key findings:- The iterative code-review stage accounts for 59.4% of all token consumption — more than initial code generation, design, and documentation combined.
- Input tokens constitute 53.9% of consumption, providing empirical evidence that context replay, not generation, is the dominant cost.
Research: observation masking cuts costs in half
arXiv:2508.21433 — "The Complexity Trap: Simple Observation Masking Is as Efficient as LLM Summarization for Agent Context Management" (Lindenbauer et al., JetBrains Research, presented at NeurIPS 2025 DL4Code workshop — arxiv.org/abs/2508.21433) is a systematic comparison of context-management strategies on SWE-bench Verified across five model configurations. Key finding: simple observation masking — dropping older environment observations from the context — halves cost relative to the raw agent baseline while matching the solve rate of LLM-based summarization (which is itself more expensive than masking). For Qwen3-Coder 480B specifically, observation masking achieves a 54.8% solve rate vs. 53.8% for LLM summarization, at significantly lower token spend. The implication is that expensive summarization steps add complexity without measurable accuracy benefit. This is the clearest published evidence that context-management strategy, not model choice, is often the highest-leverage cost variable in agentic coding pipelines.Real-world cost incidents
These are documented incidents of runaway agentic API spend — useful anchors for budgeting.$1.3 million in 30 days — OpenClaw / Peter Steinberger
Peter Steinberger (who joined OpenAI in early 2026) ran approximately 100 Codex agents autonomously on his OpenClaw project. His API dashboard showed $1,305,088.81 over 30 days, covering 603 billion tokens across 7.6 million requests. The agents reviewed pull requests, scanned commits for security issues, deduplicated GitHub issues, and opened feature PRs. OpenAI covered the cost. Steinberger noted that disabling "Fast Mode" alone would have reduced the raw API cost to roughly $300,000. Sources: Tom's Hardware, TheNextWeb.Uber exhausted its entire 2026 AI budget in 4 months
After rolling out Claude Code to its 5,000-engineer organisation in December 2025, Uber CTO Praveen Neppalli Naga confirmed to The Information that the company had exhausted its entire planned 2026 AI budget by April. By March, 84% of engineers were classified as agentic coding users. Per-engineer monthly API costs ranged from $500 to $2,000. About 70% of committed code now comes from AI. Sources: briefs.co, Startup Fortune.$47,000 from an agent loop that ran for 11 days
A four-agent LangChain-style system entered a recursive Analyzer-Verifier loop and ran undetected for 11 days. The agents were exchanging clarification requests and verification instructions back and forth continuously. The bill escalated 7x week-over-week before anyone noticed. The loop was not a malfunction — each agent was doing exactly what it was built to do. No external iteration limit or cost anomaly detector was in place. Sources: dev.to/waxell, earezki.com case study.$6,000 from Claude Code left running overnight
A developer left Claude Code running overnight on an open task. The MakeUseOf report documented the $6,000 bill as a cautionary example of unattended agentic sessions without hard spend caps.The compounding math
The cost of an agentic session is not linear. If each turn adds t new tokens and there are N turns, total input tokens scale roughly as N-squared (each turn re-sends all prior turns). A session that seems cheap at turn 5 is 25x more expensive per turn by turn 25 — before the model produces a single output token. Vantage's breakdown puts it plainly: input tokens, context accumulation, and session length are what drive the bill. Output price is secondary. Model selection and prompt caching are the two dials that matter most.Practical implications
- Always enable prompt caching. At approximately 10% of base input price for cache reads (Anthropic), a system prompt read on every turn costs almost nothing once cached. This is the single highest-ROI optimisation for any long-running agent.
- Measure cost per solved task, not cost per session. A Haiku 4.5 session that takes twice as many turns can still be cheaper than one Opus 4.8 session. Track resolution rate alongside token cost.
- Set hard iteration limits. The $47,000 loop incident was preventable with a 50-step cap. Budget alerts do not enforce limits; circuit breakers do.
- Context management strategy matters more than model choice. The Complexity Trap paper (arXiv:2508.21433) shows that observation masking halves cost with no accuracy penalty. Implementing this before upgrading to a more expensive model is the rational sequence.
Source notes
All figures on this page are third-party where possible, primary where available. None are Tokenade internal data.- [1] Vantage, "The Hidden Cost Driver in Agentic Coding Sessions in 2026" — vantage.sh/blog/agentic-coding-costs. Source of the 50-turn/1M-token session figure and the 25:1 input-to-output ratio.
- [2] Lindenbauer et al., "The Complexity Trap: Simple Observation Masking Is as Efficient as LLM Summarization for Agent Context Management," arXiv:2508.21433 (JetBrains Research, NeurIPS DL4Code 2025) — arxiv.org/abs/2508.21433. Source of the approximately 52% cost reduction from observation masking vs. raw agent baseline.
- [3] "Tokenomics: Quantifying Where Tokens Are Used in Agentic Software Engineering," arXiv:2601.14470 (January 2026) — arxiv.org/abs/2601.14470. Source of the 59.4% code-review token share and the 53.9% input-token share from 30 SDLC tasks through ChatDev.
- [4] Anthropic, Claude API pricing (2026) — platform.claude.com/docs/en/about-claude/pricing. Opus 4.8 $5/$25, Sonnet 4.6 $3/$15, Haiku 4.5 $1/$5 per MTok input/output.
- [5] Tom's Hardware, "OpenClaw creator burns through $1.3 million in OpenAI API tokens in a single month" (May 2026) — tomshardware.com. 603B tokens, 7.6M requests, 100 Codex agents, 30 days.
- [6] TheNextWeb, "Peter Steinberger's 100 AI agents racked up $1.3 million in OpenAI tokens in 30 days" — thenextweb.com. Corroborating report.
- [7] Startup Fortune, "Uber burned its entire 2026 AI budget in four months" — startupfortune.com. CTO confirmation, 84% agentic-user adoption, $500–$2,000/engineer/month.
- [8] dev.to/waxell, "The $47,000 Agent Loop: Why Token Budget Alerts Aren't Budget Enforcement" — dev.to/waxell. 11-day recursive loop incident.
- [9] MakeUseOf, "Someone left Claude Code running overnight, and it cost $6,000" — makeuseof.com. Overnight unattended session incident.
- [10] SWE-bench official leaderboard — swebench.com. Pass-rate data for Haiku 4.5 (35.9%) and Sonnet 4.6 (approx. 77%).
- [11] Caylent, "Claude Haiku 4.5 Deep Dive: Cost, Capabilities, and the Multi-Agent Opportunity" — caylent.com. Haiku 4.5 cost-efficiency analysis.
Ranked #1 on the Token-Harness Optimizer Leaderboard.
Tokenade ranks #1 in the Token-Harness Optimizer Leaderboard — an end-to-end benchmark of agent token optimizers measured on real coding sessions. Set it up once, it works on every prompt. Works with Claude Code, Cursor, Codex, Copilot & more.