4.5 Optimising Token Usage, Latency, and Cost-Performance Trade-offs
What You Need to Know
Section titled “What You Need to Know”An optimisation reduces a Claude system’s tokens, latency or cost. A lever is one such change. The dominant term is the biggest part of the bill or the wait. Every lever is useful for some workload. The skill is to match a lever to the workload’s dominant term within the 4.1 quality bar.
This lesson uses one made-up example throughout: a restaurant whose owner wants a smaller Claude bill without worse answers. The restaurant runs a booking chat, an invoice pipeline and a nightly review sort.
Rule One: Measure First
Section titled “Rule One: Measure First”Traces and usage data identify the dominant term by stage, token type and call pattern. Anthropic’s Usage and Cost Admin API programmatically reports usage by model, workspace and API key, and cost by workspace. Documented uses include cache-efficiency analysis and budget alerting. If most spend is input tokens on one stage, tuning output tokens elsewhere is no improvement. Optimising the most visible line instead is an easy mistake to miss. Trimming the restaurant’s chat replies saves nothing while invoice input dominates.
Rule Two: Re-gate With Evals
Section titled “Rule Two: Re-gate With Evals”The quality bar is a constraint. After each change, such as a cheaper invoice model, the evals run again. The change ships only if it is cheaper and still clears the bar. To ship without the rerun is a regression: the saving is measured, but the quality loss is not. Anthropic’s effort guidance agrees: reduce effort where evals show that quality holds.
Token and Cost Levers
Section titled “Token and Cost Levers”- Prompt caching suits repeated stable prefixes: long system prompts, policy documents and tool definitions sent on every request. Cache reads are billed at a small fraction of the base input price. Cache writes are billed at a premium over the base input price (current figures are in the Domain 4 quick reference). The cached content must be a prefix that stays identical byte for byte, so put stable content first. Domain 2 covers the mechanics. The booking chat sends the same allergen policy and tool definitions every time, so it has a prefix to cache. Select caching only when the workload has a repeated prefix.
- Context curation sends the fields and excludes the rest of the file. The cheapest token is one that never enters the request. The invoice stage sends the supplier, line items and totals.
- Tight output contracts cap output tokens, which are the expensive ones. The invoice stage returns a fixed set of fields.
- Effort and reasoning budgets tune spend to the task within a single model. Use low effort for simple classification and high-volume work. Use high effort for complex reasoning. Anthropic states that tuning effort is often a better lever than switching models. Spend on thinking for a trivial task is waste. Sorting reviews into praise and complaints is simple classification, so the nightly review sort runs at low effort.
- Right-sizing per stage gives each pipeline stage the cheapest model that clears its measured bar. An escalation cascade routes the hardest cases to a stronger tier. This is Domain 2’s pattern, and it is better than both a premium model everywhere and downsizing without evals. Most invoices go to a small model. The hard invoices escalate.
- Batch processing runs work that is not time-sensitive asynchronously, at a discount. Its turnaround and expiry windows are documented (figures in the Domain 4 quick reference). Anthropic describes batch processing as suited to large-scale evaluations, content moderation and bulk operations that do not need immediate responses. The cue is that no user is waiting. The words “overnight”, “bulk” and “no one is waiting” point to batch. An interactive surface excludes batch. Nobody waits for the nightly review sort, so it can go to batch. The booking chat cannot.
Latency Levers
Section titled “Latency Levers”Match the lever to the latency that the consumer experiences. At an interactive surface, this latency is time-to-first-token. In a pipeline, it is total completion time (the 4.1 distinction).
- Streaming reduces perceived latency. Users see output while the model generates it, and Anthropic recommends streaming for responsive interactive experiences. Total completion time is unchanged, so streaming is the right lever only where a human is watching. It suits the booking chat and does nothing for the invoice pipeline.
- The smallest model that reaches the measured bar reduces real latency. It is the first recommendation in Anthropic’s latency guidance.
- Parallelising independent tool calls removes serial waits. If the booking chat checks table availability and opening hours as two separate calls, it can make both at once.
- Caching improves time-to-first-token for long stable prefixes, as well as cost.
In the exam
Section titled “In the exam”Professional-level optimisation questions match a lever to the question’s dominant term. Two rules apply to every question on this objective, and most wrong options break one of them. In cost-versus-quality questions, right-sizing with a cascade is the balanced answer. An option that promises savings with no named cost and no eval rerun is a tempting wrong answer.
Exam Traps
Section titled “Exam Traps”Practice Scenario
Section titled “Practice Scenario”A nightly compliance sweep summarises 30,000 different documents on a premium model with per-request calls; finance flags the cost and wants it cut by changing the pipeline itself. Evals show a mid-tier model matches summary quality on a representative sample, and no model may replace the premium one unless tests show it meets that bar. What should the architect do?
- A. Move the sweep to the mid-tier model via batch processing, and re-run the quality evals on the batched output
- B. Keep the current setup and negotiate volume pricing with the provider before touching a pipeline that is known to work
- C. Switch to the smallest available model, and take the largest saving while the finance pressure is on
- D. Cache the document contents so repeated input tokens stop being charged at the full rate
Answer & explanation
Correct: A
- A — No user waits overnight, so asynchronous batch fits; the tier change is supported by eval evidence; and the eval rerun confirms the optimised path still meets the bar.
- B — Ignores two measured levers the evidence already supports: the workload has no waiting user (batch) and the quality bar is met by a cheaper tier (right-sizing).
- C — The question excludes this: the evals cover the mid-tier model, and nothing shows the smallest model meets the required quality. This option moves to a smaller model and skips the eval.
- D — The question excludes this: the 30,000 documents are all different, so no document’s content repeats for the cache to reuse.
Sources
Section titled “Sources”- Prompt caching — Anthropic
- Batch processing — Anthropic
- Reducing latency — Anthropic
- Effort — Anthropic
- Choosing the right model — Anthropic
- Claude Certified Architect Professional Exam Guide (v1.0) — Domain 4 — Anthropic