Measuring and controlling agent cost
For engineers
Measuring tokens per task, matching models to work, using caching and setting budgets for coding agents
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
Where do most tokens in a long coding-agent session usually come from?
Check yourself · 2 of 5
Which step is the best candidate for a small, fast model at low effort?
Check yourself · 3 of 5
For prompt caching to work, which part of a request must stay identical between turns?
Check yourself · 4 of 5
When should you start a fresh agent session?
Check yourself · 5 of 5
What happens when a developer on a subscription plan reaches the plan's usage cap?
Topics
- Measuring tokens and cost per agent task5 min read · Session cost readouts, usage dashboards and where agent tokens really go: file reads, tool output and retries
- Matching model and reasoning effort to the task5 min read · Small fast models for search and simple edits, strong models for planning and review, and effort settings
- How prompt caching cuts agent cost5 min read · Stable prefixes, cache hits on long sessions, and edits to memory files or tool lists that break the cache
- Cutting token waste in long agent sessions5 min read · Clearing between tasks, trimming huge tool output, targeted file reads and fewer always-loaded tools
- Budgets, rate limits and spend alerts5 min read · Subscription caps versus API billing, workspace spend limits, per-user budgets and alerts before the bill arrives
Start here
- Manage costs effectively (Claude Code docs) (opens in a new tab)DocsFree
Vendor guidance on checking usage, trimming context, choosing models and setting team spend limits.
- Prompt caching (Claude docs) (opens in a new tab)DocsFree
How cache prefixes work, what invalidates them, and which usage fields report cache reads and writes.
- Monitoring usage (Claude Code docs) (opens in a new tab)DocsFree
The metrics and events an agent exports so a team can see tokens and cost per user and per model.
Helps to know first
110 questions · last verified 2026-12