Back to Blog
AI Tools• September 30, 2026• 7 min

Cut LLM API Costs by 60%: Prompt Caching, Model Routing, and Batch Processing Explained

l8bites AI
AI Strategist @ l8bites

Cut LLM API Costs by 60%: Prompt Caching, Model Routing, and Batch Processing Explained

If you build with AI, your API bill has probably grown faster than your revenue. The reason is rarely the model itself — it is how you call it. Teams send every request to the most powerful model, resend the same background context on every turn, and push urgent and non-urgent work through the same expensive path. The result is a bill that is two to three times higher than it needs to be.

The good news is that the biggest savings come from three well-understood levers: prompt caching, model routing, and batch processing. None of them require sacrificing output quality. Together, they routinely cut inference costs by 50 to 70 percent. Here is exactly how each one works and how to stack them.

Why Your AI Bill Keeps Growing

Before fixing costs, it helps to understand where the money actually goes. Large language model providers charge per token, for both the input you send and the output the model generates. Input tokens are cheaper than output, but most applications are heavily input-bound: you send a system prompt, a long instruction, and a chunk of documents or conversation history, then receive a short answer back.

Three habits inflate this cost predictably:

  • Overpowered models for simple tasks. Classifying a sentence, extracting a date, or writing a subject line does not need a flagship model.
  • Re-sending the same context. Every turn in a chat resends the entire conversation history from scratch.
  • No separation of urgent and non-urgent work. A nightly report is billed the same as a real-time chat response.

Address these three habits and the savings compound quickly.

Right-Size Your Model First

The single highest-leverage change is also the simplest: stop sending every request to the most expensive model. Most workflows are a mix of tasks that genuinely need frontier reasoning and tasks that a small model handles perfectly well.

A useful rule of thumb is to route by task difficulty, not by habit. Use a flagship model like Claude Sonnet or GPT-4o for reasoning, long-form writing, and complex code. Use a small model like GPT-4o mini, Claude Haiku, or Gemini Flash for classification, summarization, extraction, and formatting. The small models are often 10 to 20 times cheaper per token, and they are fast enough that users notice the improvement rather than the difference.

OpenRouter makes this easy by giving you a single API surface across many models, so you can swap a model name in one line instead of rewriting your integration code.

Prompt Caching: Pay Once, Reuse the Context

Prompt caching is the most underused cost lever in the industry. Instead of re-processing your system prompt and shared context on every request, the provider stores those tokens and reuses them for a fraction of the original price.

Claude was one of the first to ship this with cache_control breakpoints: mark a block of your prompt as cacheable, and subsequent calls within the cache window are charged at roughly a tenth of the normal input-token rate. OpenAI introduced automatic prompt caching on long prompts, and Gemini offers context caching with an explicit cache resource you create once and reference across requests.

This shines in agent loops and retrieval-augmented generation applications. If an agent reads the same 20,000 tokens of documentation on every step, caching that block means you stop paying full price for those 20,000 tokens on every single step. In practice, teams have reported cutting input-token spend by 70 to 90 percent on cache-heavy workloads.

The pattern is simple: keep stable content at the front of your prompt, keep variable content at the end, and mark the stable block as cacheable.

Batch Processing: Half the Price for Non-Urgent Work

Not every request needs an answer in under a second. Reports, bulk classification, embeddings, and content generation pipelines can usually wait minutes or even hours.

OpenAI's Batch API processes jobs asynchronously and returns a 50 percent discount on both input and output tokens. Anthropic and Gemini offer similar batch modes. The tradeoff is latency — jobs complete within a defined window rather than instantly — but for anything that runs overnight or on a schedule, the discount is effectively free money.

A practical workflow: connect your automation tool (like n8n) to the batch endpoint, queue all non-interactive tasks into a single nightly job, and let real-time traffic use the standard endpoint. You keep instant responses where they matter and pay half price everywhere else.

Model Routing: Send Each Request to the Cheapest Capable Model

Right-sizing manually is fine at small scale, but routing becomes more powerful when it is automated. A router inspects each incoming request and decides which model should handle it based on complexity, latency needs, and cost.

There are two common approaches:

  • Semantic routing. A lightweight classifier scores each request and sends easy tasks to a small model and hard tasks to a large one. You can build this in a few lines with an embeddings model, or even a small LLM doing the classification itself.
  • Provider routing. Services like OpenRouter route requests to the cheapest provider currently offering the model you want, and can cascade to a fallback model if a provider is down or slow.

The key insight is that routing lets you keep one unified application while paying different prices per request. A support chatbot, for example, might answer 70 percent of questions with a mini model and escalate the rest — cutting blended cost by more than half without any user noticing the difference.

Token Discipline: Shrink What You Send

Caching and routing reduce the unit price, but you should also reduce the volume. A few habits make an immediate dent:

  • Keep system prompts tight. A 2,000-token system prompt charged on every request is expensive; a 300-token prompt that says the same thing is not.
  • Truncate conversation history aggressively, and use summarization when you need distant context.
  • Use structured outputs instead of asking the model to format free text and then parsing it — you get shorter, cleaner responses and fewer retries.
  • Do not dump entire documents when a relevant excerpt will do. Retrieval beats context-stuffing on both cost and accuracy.

Monitor Spend Before It Spirals

None of these levers matter if you cannot see your spend. Set per-key usage limits, tag requests by feature, and alert when daily spend crosses a threshold. Most providers offer dashboards and usage APIs; a simple weekly report in your workflow tool is enough to catch a runaway loop before it burns a full day's budget.

The Savings Stack at a Glance

LeverTypical SavingsBest For
Right-size the model50–80% per requestAll workloads
Prompt caching70–90% on cached inputAgents, RAG, chat
Batch processing50% on eligible jobsReports, bulk tasks
Model routing40–60% blendedHigh-volume apps
Token discipline20–40%Every request

Notice that the levers stack: right-sizing plus caching plus batching can take a bill that would have been $1,000 down to $300 or less, without touching the quality of what you ship.

Where to Start This Week

Do not try to implement everything at once. This week, do three things:

  1. List your top five most-called prompts and check whether any can move to a mini model.
  2. Turn on prompt caching for your longest-lived context and confirm the discount is applying in your billing dashboard.
  3. Move one nightly or bulk job to a batch endpoint and measure the difference.

AI inference is now a meaningful line item for most teams, but it is also one of the most controllable. With a little discipline around caching, routing, and batching, you can cut your bill dramatically and redirect the savings into building more.

Want the whole stack automated? l8bites AI builds cost-efficient AI workflows that route, cache, and batch for you, so you get premium output at a fraction of the bill. That is the whole idea behind "little bites for AI."