AI LLM costsAI APIsOptimisation

How to cut LLM API costs: caching, batching and model routing

AI API bills grow quietly. These techniques can cut them substantially without hurting quality.

UUIUX Studio Editorial Team 5 min read
AI
How to cut LLM API costs: caching, batching and model routing
Techniques to reduce large language model API costs
Where cost comes from
Tokens times price
Cost is input and output tokens multiplied by each model’s rate.
$4,200MONTHLY SPEND
The fixes
Route, cache, batch
Small models for easy tasks, caching for repeated context and batch for background jobs.
01Route
02Cache
03Batch
04Monitor
THE SHORT ANSWER

To cut LLM API costs, use the smallest model that meets your quality bar, route simple tasks to cheap models and only hard ones to expensive models, cache repeated context with prompt caching, send non-urgent work through batch APIs at about half price, keep prompts and outputs short, and track cost per task. On Claude, for example, Haiku 5.5 costs $0.50 per million output tokens against $20 for Opus 5.5, and cache reads cost a fraction of normal input.

KEY TAKEAWAYS
  • ✓Model choice is the biggest lever: prices differ up to 40 times
  • ✓Route tasks by difficulty instead of using one model for everything
  • ✓Prompt caching cuts the cost of repeated context sharply
  • ✓Batch APIs offer about 50% off for jobs that can wait
  • ✓Measure cost per completed task, not just total spend

Why do LLM costs grow so fast?

API pricing is per token: you pay for every word you send and every word the model writes back. Costs climb when teams use the most capable model for every request, resend long system prompts or documents each time, ask for long answers and run agents that call the model many times per task. The fixes are mostly design choices, not discounts. Our Claude API guide explains how tokens and pricing work.

Claude API price per million output tokens (USD, October 2026)
USD per million output tokens
Haiku 5.5$0.50
Sonnet 5.5$10
Opus 5.5$20
Fable 5.1$50
Input prices: $0.10, $2, $4 and $10. Haiku rate applies to prompts up to 100,000 tokens.

What are the main cost levers?

M
Model choice
Use the smallest model that passes your quality test.
R
Routing
Send easy tasks to cheap models and escalate hard ones.
P
Prompt caching
Cache long, repeated context such as instructions and documents.
B
Batch processing
Run non-urgent jobs through batch APIs at about half price.
S
Shorter prompts
Remove unused instructions and send only relevant context.
S
Shorter outputs
Ask for concise formats and set output limits.

How does model routing work?

A routed request
Classify
A small, cheap model sorts requests
  • Simple, standard or complex
Answer
Each goes to the right tier
  • Simple → small model
  • Standard → mid-tier
  • Complex → frontier
Check
Escalate when unsure
  • Low confidence goes up a tier
  • Log cost and outcome

In many applications most requests are simple, so routing alone can cut costs substantially. Our AI model decision framework shows how to test which tier each task needs.

How much does prompt caching save?

Prompt caching stores a long, repeated part of a prompt, such as instructions, a style guide or a large document, so later requests read it from cache instead of paying full input price. On Anthropic’s API, cache reads cost a small fraction of normal input, while writing to the cache costs slightly more than normal input, so caching pays off when the same context is reused several times. OpenAI and Google offer similar mechanisms. Put stable content first in the prompt and variable content last, so the cacheable part stays identical.

When should you use batch APIs?

Batch APIs accept many requests at once and return results within hours rather than seconds, at about half the normal price on major providers. They suit overnight jobs such as tagging support tickets, summarising documents, generating product descriptions or evaluating test sets. Anything a person is waiting for should stay on the real-time API.

Mashreq NEO case study
Case study · Mashreq NEO Executive dashboards and an AI assistant One view of bank performance for leadership, plus an AI assistant that answers questions from internal documents.
1View of bank performance
Power BIReporting
AzureAI platform
View case study →

Why are agents especially expensive?

  • Each step resends the growing conversation and tool results
  • Multi-agent systems multiply calls
  • Retries and loops add hidden cost
  • Large tool outputs inflate input tokens

Set limits on steps and spend per task, trim tool outputs and cache the agent’s instructions. Our AI agent cost guide covers budgeting.

What does this look like in practice?

A support platform answers around 50,000 customer questions a month using a frontier model for every request, with a 6,000-token system prompt and help-centre extracts resent each time. The team makes four changes. A small model now classifies each question and answers the simple ones, about two thirds of the total; only complex questions go to the larger model. The fixed instructions are cached, so repeated requests pay the cache-read rate. Overnight tagging and summarising moves to the batch API. Answers are capped at around 150 words unless the customer asks for detail. Measured on the same test set, answer quality is unchanged, while the monthly bill falls sharply. Figures differ by product, but this combination is the usual pattern.

What mistakes should you avoid?

  • Optimising before measuring which features cost the most
  • Switching to a cheaper model without re-running your test set
  • Changing the start of prompts constantly, which breaks caching
  • Sending whole documents when only a few passages are needed; use RAG instead

How do you keep costs under control?

  1. 1
    Tag every request
    Record feature, model, tokens and cost.
  2. 2
    Measure cost per task
    Track cost per resolved ticket or processed document, not just totals.
  3. 3
    Set budgets and alerts
    Use provider spend limits and your own alerts.
  4. 4
    Review monthly
    Find the most expensive features and optimise them first.
  5. 5
    Re-test after releases
    New, cheaper models may meet your bar.
Typical impact of each technique
12345
Smaller savingBigger saving
1
Shorter outputs
Modest but easy
2
Shorter prompts
Removes waste
3
Batch API
About half price for background work
4
Prompt caching
Large when context repeats
5
Model routing
Often the biggest lever

How UIUX Studio helps

We audit AI features for cost, implement routing, caching and batching, and set up monitoring so spend stays predictable. Talk to our product engineering team.

Frequently asked questions

Use a smaller model where it meets quality, and route only hard tasks to larger ones.

Storing repeated prompt content so later requests read it at a much lower price.

About 50% on major providers, for jobs that can wait.

Not if you test them on your tasks and keep a fallback to a larger model.

Per feature and per completed task, with budgets and alerts.

U
Written by UIUX Studio Editorial Team
Design & engineering leads, Dubai · India · Australia

For Ambitious Founders

Startup Strategy Session Discuss Your Project with Our Senior Experts

  • No Obligation
  • Expert Insights
  • Tailored Guidance