Skip to content
AISpendbook

Guide · 9 min read

Reduce LLM costs without hurting quality: 5 levers

By AI Spendbook · Published · Updated

Short answer

Start with the changes that leave outputs unchanged: prompt caching for repeated prefixes and batch processing for work that can wait a day. Then shorten prompts, route easy requests to a smaller model, and migrate whole workloads last, after testing the candidate model on a few hundred of your own examples.

Key takeaways

  • Prompt caching and batch APIs cut cost without changing a single output.
  • Anthropic and OpenAI bill batch requests at about half the standard price, with results within 24 hours.
  • Input tokens are usually most of the bill, so trimming context often beats switching models.
  • Judge each change by billed cost per request for the feature over a week, not by total spend.
A garden workbench holds an open ledger and two stacks of blocks of different sizes.

Most LLM cost advice starts with "use a cheaper model". That is the riskiest change, not the first one. The levers below are ordered from the ones that leave outputs unchanged to the ones that need testing.

1. Prompt caching (no change to outputs)

If many requests share a long prefix (a system prompt, instructions, a document or tool definitions), caching lets the provider bill the repeated part at a much lower rate. Anthropic, OpenAI and Google all offer it, with different rules for how the cache is created and how long it lasts. Put the stable content first and the changing content last so the prefix matches.

Worked example, with a hypothetical base input price of $3.00 per million tokens and Anthropic's published multipliers (cache writes with a 5-minute lifetime at 1.25x the input price, cache reads at 0.1x on most models). A support bot handles 10,000 requests a day, each with the same 6,000-token system prompt and tool definitions plus 500 new tokens.

Hypothetical price and traffic. Input cost falls from $195.00 to $33.41 a day, 83% less; output tokens are unchanged.
Tokens a dayPrice per millionCost a day
Without caching: every input token10,000 x 6,500 = 65,000,000$3.00$195.00
With caching: cache writes (about 20 a day, after quiet spells and deploys)20 x 6,000 = 120,000$3.00 x 1.25 = $3.75$0.45
With caching: cache reads9,980 x 6,000 = 59,880,000$3.00 x 0.1 = $0.30$17.96
With caching: new tokens10,000 x 500 = 5,000,000$3.00$15.00
With caching: total$33.41

The saving depends on the cache staying warm. The default lifetime is 5 minutes and each hit refreshes it, so steady traffic keeps it alive; a request every ten minutes pays the write price almost every time and saves little. Prompts below the model's minimum cacheable length (512 to 4,096 tokens on Anthropic models) are not cached at all.

2. Batch processing (no change to outputs)

Work that doesn't need an answer within seconds, such as nightly classification, evaluations, summaries and backfills, can go through the batch APIs. Anthropic and OpenAI bill batch requests at about half the standard price in exchange for results within 24 hours. A nightly classification job that costs $120 a day through the normal API costs about $60 through batch: $60 x 30 = $1,800 a month saved, with no change to prompts or outputs. The trade is latency: anything a user waits for stays on the normal API.

3. Low risk: do shorter prompts cut LLM costs?

Pruning shears and two bundles of leaves with the same gold flower.

Input tokens are usually most of the bill. Remove duplicated instructions, trim retrieved context to what the answer needs, and cap conversation history. Check a sample of outputs before and after, because some instructions that look redundant are doing work.

4. Route simple requests (medium risk)

Many workloads mix hard and easy requests. Sending the easy share (short questions, classification, extraction) to a smaller model and keeping the rest on the large one can cut cost substantially. It needs a rule that identifies easy requests reliably and a fallback for the cases the small model gets wrong.

Illustrative numbers: 100,000 requests a month at $0.012 each on the large model cost $1,200. A rule sends 60% to a small model at $0.001: 60,000 x $0.001 = $60. The other 40,000 stay at $0.012 = $480. If 5% of routed requests fail a check and retry on the large model, that is 3,000 x $0.012 = $36 more. New total $60 + $480 + $36 = $576, a 52% saving, but only if the quality check that triggers the fallback is reliable. Measure the retry rate in production; at a 30% retry rate most of the saving is gone.

5. Highest risk: should you migrate to a cheaper model?

Moving a whole feature to a cheaper model gives the biggest saving and the biggest risk. Two checks before deciding:

  • Quality on your data. General benchmarks don't establish equal quality on your task. Run both models on a few hundred representative examples and compare the results. How to tell if a cheaper AI model is ready to ship sets out the review.
  • Price over time. Compare cost over the next 30 days with each price applied on the dates it is in effect, and look at the price after any scheduled change. A saving that relies on an introductory rate can disappear when it ends.

Running an open model on your own GPUs is another kind of migration. It pays only when traffic keeps the hardware busy; see self-hosted open model vs API for the method.

What are the common mistakes when cutting LLM costs?

  • Breaking the cache prefix. A timestamp, user name or request id at the top of the prompt makes every prefix different, so nothing is ever read from cache. Put it at the end.
  • Switching models first. It is the change most likely to hurt quality, and caching or batching may give most of the saving with no risk.
  • Judging by total spend. A quiet week looks like a saving. Compare cost per request for the changed feature.
  • Routing without a fallback. Easy-looking requests that the small model gets wrong reach users.
  • Trimming instructions blindly. Some lines that look redundant are what keeps the output format stable. Compare outputs before and after.

When is optimising LLM cost not worth it?

When the feature's AI cost is a small share of what it earns, engineering time spent on routing or migration often costs more than the saving; turn on caching and batching, which are cheap to adopt, and stop there. Hold off as well while the product itself is still changing quickly, because each prompt rewrite resets the measurements. The AI cost per customer guide shows how to see whether AI cost is large enough to matter for margin.

How do you know an LLM cost cut worked?

Judge every change by cost per request for the feature you changed, in billed spend, over at least a week. A drop in total spend can come from lower traffic; a drop in cost per request is the real effect. The unit economics guide explains how to set that up.

AI Spendbook finds these opportunities from your own token mix: it estimates savings from caching, batching, routing, shorter prompts and model migration, ranks them by savings over the next 30 days, flags scheduled price changes, and can validate a migration with an evaluation on your examples. See Model Intelligence.

Sources

Frequently asked questions

Does prompt caching change the model's answers?

No. Caching only changes how the repeated prefix of a prompt is billed. The model sees the same input, so outputs are unchanged; what changes is the price of the cached tokens and, on some providers, a small charge to write the cache.

Which LLM workloads suit the batch API?

Anything that does not need an answer within seconds: nightly classification, evaluations, summaries, data enrichment and backfills. Batch requests return within 24 hours at about half the standard price on Anthropic and OpenAI.

Is routing easy requests to a smaller model worth the risk?

Often, when a large share of traffic is simple and a rule can spot it reliably. Keep a fallback to the large model for the cases the small one gets wrong, and compare quality on real examples before turning it on for everyone.

Start with your own numbers.

Every plan is free during launch. No credit card.