How to Reduce LLM API Costs: 8 Techniques That Actually Work
Updated November 2026 · 7 min read
First, benchmark your current spend: LLM API Cost Calculator — enter token counts to see your monthly cost at current rates.
LLM API bills can spiral quickly in production. A RAG pipeline processing 10 million tokens per day with GPT-4o costs over $25,000 per month. The same workload with the right optimisations can cost under $3,000. Here are 8 techniques, ordered from easiest to implement to most impactful.
1. Use a Cheaper Model for Simpler Tasks
Not every request needs a frontier model. GPT-4o mini at $0.15/1M tokens handles classification, extraction, and summarisation nearly as well as GPT-4o at $2.50/1M — a 16x cost reduction. Audit your workload: route simple tasks to cheaper models and reserve the expensive model for complex reasoning.
Example savings:
10M input tokens/day × $2.50 (GPT-4o) = $750/day
10M input tokens/day × $0.15 (GPT-4o mini) = $45/day
Savings: $705/day — 94%
2. Enable Prompt Caching
Anthropic Claude and OpenAI both support prompt caching, which stores frequently reused prefixes (system prompts, documents, conversation history) and charges 50–90% less for cached token reads. If you pass the same 10,000-token system prompt on every request, caching pays for itself after the first call.
Claude charges 10% of the normal input rate for cache hits. OpenAI charges 50% for cache hits. For a document Q&A app where the same doc appears in every call, this alone can cut input costs by 80%.
3. Use the Batch API (OpenAI / Anthropic)
Both OpenAI and Anthropic offer batch endpoints that process requests asynchronously (results within 24 hours) at a 50% discount. If any part of your pipeline doesn’t need a real-time response — nightly report generation, bulk document analysis, weekly data processing — use the batch API.
4. Compress Your Prompts
Every word in your prompt costs money. Audit your system prompts and remove redundant instructions, examples, and filler. Tools like LLMLingua can compress prompts by 3–5x with minimal quality loss by removing low-information tokens.
A typical chatbot system prompt can often be cut from 2,000 tokens to 500 tokens without changing behaviour. At 10M requests/day with GPT-4o, reducing system prompt length by 1,500 tokens saves $37.50 per day ($1,125/month).
5. Set max_tokens Limits
Output tokens are 4x more expensive than input tokens on most models. A model left unconstrained may write 1,000 tokens when 200 would suffice. Always set max_tokens based on the expected output length for your task. Combine this with explicit output format instructions (“respond in 3 bullet points”, “answer in one sentence”).
6. Switch to Open-Weight Models via OpenRouter
Open-weight models like Llama 3.3 70B, Mistral Large, and DeepSeek V3 are available via OpenRouter at 80–95% lower cost than proprietary models. OpenRouter provides an OpenAI-compatible endpoint, so switching requires one line of code (change the model ID and base URL).
7. Implement Semantic Caching
Semantic caching stores LLM responses and retrieves them for semantically similar queries. If 20% of your requests are near-duplicates (common in customer support, FAQ bots), a semantic cache like GPTCache or a vector DB query layer can reduce API calls by 15–30% with no quality loss.
8. Right-Size Your RAG Chunks
In RAG pipelines, the most common cost mistake is retrieving too many chunks. Retrieving 10 × 500-token chunks per query adds 5,000 tokens to every call. Tune your retrieval top-k and chunk size: start at top-3 and 256-token chunks, then increase only if accuracy suffers.
Calculate Your Potential Savings
Enter current vs. optimised token volumes to see the exact dollar difference:
Open LLM Cost Calculator →Frequently Asked Questions
What is the fastest way to cut an LLM API bill?
Switch to a cheaper model (GPT-4o mini, Gemini Flash, or Llama 70B) for tasks that don’t need frontier capability. This is a one-line code change and often saves 80–95% with minimal quality impact.
Does prompt caching work automatically?
On OpenAI, prompt caching is automatic for prompts with matching prefixes of 1,024+ tokens. On Anthropic, you must explicitly mark cache breakpoints in your API call. Both apply the discount transparently on your invoice.
How do I track my actual token usage per request?
All major providers return token usage in the API response object under usage.prompt_tokens and usage.completion_tokens. Log these per request and multiply by the per-token rate to get exact per-call cost. Our calculator helps you translate those numbers into monthly projections.