Cost control
For engineers
Measuring token spend per request and feature, then cutting it with caching, batching, output caps and smaller models
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
A response reports 2,000 input tokens and 300 output tokens. Input costs $2 per million and output $10 per million. What does the call cost?
Check yourself · 2 of 5
Why does a prompt that starts with the current timestamp get no cache hits?
Check yourself · 3 of 5
Which task suits a batch API best?
Check yourself · 4 of 5
How should you decide whether a cheaper model is good enough for a task?
Check yourself · 5 of 5
Why does a 30-turn chat cost far more per turn at the end than at the start?
Topics
- Counting tokens and cost per request4 min read · Input, output, cached and reasoning tokens, per-million prices, token counting before sending and cost per feature
- Cutting repeat input cost with prompt caching5 min read · Stable prefixes first, cache breakpoints, cache lifetime, write versus read pricing and measuring the hit rate
- Moving non-urgent calls to discounted batch pricing4 min read · Spotting calls that can wait hours and estimating what the batch discount saves on them
- Routing easy requests to smaller models4 min read · Matching each task to the cheapest model that passes its evaluation, and measuring the quality cost
- Capping output length and growing history5 min read · Output token limits, verbose answers, effort settings and conversation or agent history that grows every turn
Start here
- Claude API pricing (opens in a new tab)DocsFree
Per-million-token prices, the cache write and read multipliers and the batch discount in one table.
- Prompt caching (Claude docs) (opens in a new tab)DocsFree
Cache breakpoints, the 5-minute and 1-hour lifetimes and the usage fields that report writes and reads.
- Batch processing (Claude) (opens in a new tab)DocsFree
How the Message Batches API works and what it costs compared with standard calls.
Scenarios
Helps to know first
110 questions · last verified 2026-12