Explained series Episode 7 about 11 min
What an AI agent costs: tokens, caching and budgets
About this episode
How LLM token pricing adds up in an AI agent: input and output tokens, why an agent loop's token use grows quadratically with its steps, and how prompt caching works and what breaks it. Then budgets that cap a run, like step limits and dollar limits, plus smaller models, compaction and the Batch API.
Written by Kiran Krishna. Narrated with an AI voice. · LinkedIn
In this episode
- 0:01A coding agent that takes 50 steps to fix a bug can cost about $6.
- 0:59Here's the plan.
- 1:11So what exactly are you paying for?
- 2:47So how fast does that add up?
- 5:03So do you really have to pay full price, to read the same text again?
- 7:58So does caching fix the bill?
- 10:07So where does an agent's money go?
Sources check every one
- Anthropic docs, Pricing (list prices on 7 November 2026: Sonnet 5.5 at $2 in and $10 out per million tokens; output at 5× input on every Claude model; cache writes and cache hits; Haiku 5.5 up to 100,000 tokens) platform.claude.com
- Anthropic docs, Steering thinking (thinking billed as output, even when hidden; each request in a run has its own maximum length) platform.claude.com
- Claude Code docs, Manage costs effectively (thinking can run to tens of thousands of tokens a request; agent teams at about 7× a standard session's tokens in plan mode) code.claude.com
- Manus, Context Engineering for AI Agents: Lessons from Building Manus (July 2025: about 100 tokens read for every one written; about 50 tool calls in a typical task; timestamps that break the cache; append-only context) manus.im
- Anthropic, How we built our multi-agent research system (June 2025: one agent about 4× and a team about 15× the tokens of a chat) anthropic.com
- Claude Code docs, How Claude Code uses prompt caching (the prefix; the match has to be exact; each model has its own cache) code.claude.com
- Anthropic, Prompt caching with Claude (August 2024: a 100,000-token prompt started answering in 2.4 seconds, not 11.5) claude.com
- OpenAI docs, Prompt caching (it doesn't change the output; on by default; 1,024-token minimum) developers.openai.com
- OpenAI docs, GPT-6.1 Sol (cached input at a twentieth of the normal price) developers.openai.com
- Google, Gemini API docs, Context caching (on by default; 4,096-token minimum on Gemini 4 Argon) aistudio.google.com
- Google, Gemini API docs, Gemini Developer API pricing (Gemini 4 Argon's cached input at a twentieth of its input price) aistudio.google.com
- Anthropic docs, Prompt caching (five-minute lifetime; 512-token minimum on Sonnet 5.5; what invalidates the cache; adding instructions partway through) platform.claude.com
- Anthropic docs, Context editing (clearing old results invalidates the cached prefix) platform.claude.com
- Anthropic, Lessons from building Claude Code: Prompt caching is everything (April 2026: static content first; a low cache hit rate treated as an incident) claude.dev
- Claude Agent SDK docs, How the agent loop works (a turn limit and a dollar cap, both off by default; what a capped run returns; compaction) code.claude.com
- Anthropic docs, Task budgets (beta: telling Claude its budget so it can wrap up first) platform.claude.com
- Anthropic docs, Batch processing (half price; most batches finish within an hour; 24 hours at most) platform.claude.com
- OpenAI docs, Batch API (half price, within 24 hours) developers.openai.com
