How to Reduce OpenAI API Costs: 9 Levers That Actually Move the Bill
Cut your OpenAI bill 40-70% with 9 proven levers — model routing, semantic caching, context trimming, and more. Where to start, and how to measure what's working.
Most teams overpay on LLM APIs by 40-70%, and the reason is rarely a single fat mistake — it’s six small ones running at once. The hard part isn’t knowing the levers exist. It’s knowing which one to pull first for your traffic, because pulling the wrong one wastes a sprint for a 4% saving.
Here are the nine levers that actually move an OpenAI (or any provider’s) bill, ordered from highest-leverage to cleanup — and a note at the end on how to tell which matters for you.
1. Model routing — send each request to the cheapest capable model
The biggest lever. 60-80% of production requests are simple enough for a model 10-30x cheaper than GPT-4-class frontier models. Routing those down typically cuts 40-70% of cost with under 2% quality impact. This is almost always where to start. We covered the implementation patterns — rule-based, classifier, and cascade — in depth: Model Routing for Cost Savings.
2. Semantic caching — stop paying twice for the same answer
Production traffic is repetitive. The same questions, near-duplicate prompts, the same retrieval contexts recur constantly. Semantic caching returns a stored answer for a sufficiently-similar prompt instead of paying for a fresh completion. For support and FAQ-style workloads, hit rates of 30-50% are common — and a cache hit costs effectively nothing. Full walkthrough: Semantic Caching for Cost Reduction.
3. Prompt and context trimming
You are billed per input token, and most prompts are bloated: a 600-token system prompt that could be 200, full documents pasted in where a relevant chunk would do, entire conversation histories re-sent when a summary would suffice. Trimming context is pure margin — you pay less on every single call, forever. Audit your highest-volume prompt and cut it ruthlessly.
4. Batching and async where latency allows
Not every request needs a sub-second response. Background jobs — overnight summarization, bulk classification, embeddings — can use the provider’s batch tier, which is heavily discounted (often ~50% off) in exchange for a slower, asynchronous turnaround. If a workload doesn’t need to be synchronous, it shouldn’t be paying synchronous prices.
5. Output token caps and structured outputs
Output tokens cost several times more than input tokens. A model told to “explain” will happily write four paragraphs where one sentence was needed — and you pay for all four. Set max_tokens deliberately, and use structured/JSON outputs to force concise, schema-bound responses instead of prose. This single change can shave 20-40% off output-heavy features.
6. Provider-tier and model selection
Within a single provider there are large price steps between model tiers, and the newest frontier model is rarely the right default. Pick the floor model that meets each feature’s quality bar rather than defaulting to the top of the menu. Re-check this quarterly — providers ship cheaper, equally-capable models constantly, and last quarter’s right choice is often this quarter’s overpay.
7. Prompt caching
Distinct from semantic caching: most providers now offer prompt caching, where a stable prefix (a long system prompt, a fixed instruction block, a reused document) is cached server-side and billed at a steep discount on repeat calls. If you send the same large prefix on every request, enabling prompt caching is nearly free money — often 50-90% off the cached portion.
8. Retry-budget limits
Retries are a silent cost multiplier. A flaky tool or a strict validation check can turn one call into five, and an unbounded retry loop can run all night. Cap retries per task, add backoff, and put a hard ceiling on per-task spend so a stuck agent fails closed instead of failing expensive.
9. Kill shadow and zombie spend
The cleanup lever, and often a surprising chunk. Old API keys still wired to deprecated features. A “temporary” debug script someone left running. A team using a model outside the budget nobody tracks. You can’t cut what you can’t see — which is the whole point of attribution. Token cost tracking by feature and key surfaces the spend that has no owner.
The lever you pull first depends on your data
Here’s the discipline that separates a real 50% cut from a wasted sprint: measure cost-per-task, by model and feature, before you touch anything.
- A few expensive-model features dominating the bill → routing wins (lever 1).
- Lots of near-duplicate prompts → caching wins (levers 2, 7).
- Long, rambly outputs → token caps win (lever 5).
- A line item nobody recognizes → shadow spend (lever 9).
You cannot optimize what you cannot see, and guessing which lever matters is how teams burn a sprint for a rounding error. Want a fast first estimate? The LLM cost calculator models your spend from a traffic mix in minutes; token cost tracking gives you the per-feature truth once you’re ready to instrument.
The reason this is hard in the first place — that LLM costs are invisible until the invoice arrives — is a problem we unpacked on the AI Vyuh parent blog. Every lever here is downstream of one thing: making the cost visible enough to act on.
Further reading
- Model Routing for Cost Savings — lever #1, in depth
- Semantic Caching for Cost Reduction — lever #2, in depth
- Token Cost Tracking — measure cost-per-task by model and feature
- LLM Cost Calculator — estimate spend and savings from your traffic mix
Provider pricing and batch/caching discounts change frequently — verify current rates on the provider’s pricing page before building financial models.