Topic 4 of 6 · 6 min read
Levers that cut inference cost
Goal: Pick the cost levers for a feature's cost profile and state the quality check each change needs before release.
Cut inference cost by changing one lever at a time, matching the lever to where the spend actually is, and checking the quality bar before every release. A cheaper feature that gets worse answers is not cheaper, because failures and rework cost more than tokens.
Check yourself · 1 of 3
A feature sends the same 8,000-token policy document at the start of every request. Which lever fits best?
Why it matters
Teams often start by switching everything to a smaller model, lose quality, and switch back. Better results come from finding where the money goes first. Look at the cost table from the first topic: which part is largest?
The levers
- Route by difficulty. Send easy requests to a small, cheap model and hard ones to a larger model. A cheap classifier or simple rules decide which. Check that the router does not send hard cases to the small model.
- Prompt caching. If many requests start with the same long text, such as instructions or a reference document, providers can store that prefix and charge less to read it again. It helps most when the shared part is large and requests come close together. See the provider's caching page for rules.
- Batch processing. Work that nobody is waiting for, such as nightly tagging or report generation, can go through a batch interface that returns results later, at a lower price.
- Shorter prompts and outputs. Trim old history, drop unneeded retrieved passages, and ask for a compact format. Output tokens usually cost more than input, so a shorter answer saves more than a shorter prompt.
- Effort and reasoning settings. Many models let you limit how much they think. Use low effort for simple tasks and spend more only where it helps.
- Usage limits. Caps per user or per task stop runaway loops and abuse.
How to apply one
- Find the biggest cost line.
- Pick the lever aimed at it.
- Run the same test set before and after, and compare quality as well as cost.
- Release to a small share of traffic first and watch quality and complaints.
Before and after
Weak: "Move everything to the cheapest model; we saved 70 percent."
Better: "Route the 60 percent of requests that are FAQ lookups to the small model, keep the rest on the large one, and verify on 300 saved cases that accepted answers dropped by less than one point."
What goes wrong
- Optimising a small line. Shaving a short prompt when review time dominates.
- No test set. You cannot tell if quality fell.
- Caching with changing prefixes. If the shared text changes each request, nothing is reused.
Examples
Matching lever to cost profile
| Cost profile | First lever |
|---|---|
| Long fixed instructions in every call | Prompt caching |
| Overnight report generation | Batch processing |
| Mostly simple questions, some hard ones | Routing by difficulty |
| Long rambling answers | Output length limit |
| Agent loops that run away | Step and budget cap |
A change that failed its check
A team cut costs 40 percent by moving a contract-summary feature to a smaller model. On their 200-case test set, summaries that missed a payment term rose from 3 to 19. The saving was real and the feature was worse. They routed only short contracts to the small model.
Key points
- Find the largest cost line first, then choose the lever aimed at it.
- Routing, caching, batching, shorter outputs, effort settings and limits each fit a different cost profile.
- Output tokens usually cost more than input, so trimming answers often saves more than trimming prompts.
- Prompt caching only helps when many requests share a long, stable prefix.
- Run the same test set before and after every change and compare quality as well as cost.
Common mistakes
- Switching to the smallest model across the board without a test set.
- Caching a prompt prefix that changes with every request.
- Using a batch interface for something a user is waiting on.
- Judging success by the token bill alone.
Check yourself · 2 of 3
Before moving a feature to a smaller model to save money, what should you do?
Check yourself · 3 of 3
A nightly job tags 200,000 support tickets. Results are needed by morning. Which lever suits this?
Practice items, not counted towards your mastery.
Start here
- Claude API pricing (opens in a new tab)DocsFree
Per-token prices for input, output, cached and batch requests, the inputs to every cost-per-task calculation.
- OpenAI API pricing (opens in a new tab)DocsFree
A second provider's price list, to compare model tiers and see how cached input and batch are priced.
- LLM inference prices have fallen rapidly but unequally (Epoch AI) (opens in a new tab)ArticleFree
Measured price declines by capability level, with the spread between tasks that a forecast needs.
More for this topic
- Prompt caching (Claude docs) (opens in a new tab)DocsFree
How cached prefixes are written, read and priced, and what makes a cache hit.
- Batch processing (Claude) (opens in a new tab)DocsFree
How asynchronous batch requests work and when a delayed result is acceptable for a lower price.