The Official Discounts You're Not Using: Setting Up Prompt Caching and Batch API to Halve Your AI Bill
Before switching models, switch on the two official discounts providers already offer: prompt caching and batch API. Cut your bill 50-90 percent.

When an API bill climbs by double digits every month, the reflexive decisions are drastic: downgrade to a cheaper model, or cut your context until answer quality collapses. Before either, there is a healthier step most teams skip: switching on the official discounts that providers already ship. The two with the biggest impact are prompt caching, a price cut on repeated input tokens, and the Batch API, 50 percent off work that does not need an instant answer. Both take minutes to set up, with no model change and no quality trade-off. This tutorial walks you from diagnosis all the way to proving the savings with real numbers.
Diagnose first: where are your tokens going
Before installing anything, open your provider's usage dashboard and check three things: the split between input and output tokens, how much is already cached, and which requests are the greediest. The most common bill-bloater is large context sent over and over: a 20-page product manual, tool definitions, or brand rules retyped on every call. If 80 percent of your prompt is identical from one request to the next, you are the perfect candidate for caching. Write down your baseline, such as tokens and cost per day, so the effect of every change can be measured later.
Prompt caching: pay a fraction for repeated context
Prompt caching stores an identical prompt prefix on the server and re-reads it at a much lower price on subsequent calls. On OpenAI, caching is enabled by default for prompts long enough, around 1,024 tokens and up; you do not need to change code, just watch the cached_tokens field in the response. On Anthropic, caching is triggered explicitly through a cache_control breakpoint:
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
system=[{
"type": "text",
"text": PRODUCT_MANUAL, # large, static document
"cache_control": {"type": "ephemeral"},
}],
messages=[{"role": "user", "content": user_question}],
)
The pricing is symmetrical and worth memorizing: cache writes cost 25 percent extra, but every cache hit is billed at roughly one tenth of the normal input price. That means a 50-page document cited hundreds of times a day becomes nearly free once the cache is warm. Caches live for a few minutes, roughly 5 to 30 depending on the model and provider, and their lifetime is refreshed every time they are used. For sparser traffic, Anthropic offers an optional one-hour TTL.
Structure your prompt: static first, dynamic last
Caching matches prefixes: a single different character early in the prompt invalidates everything after it. So reorder your prompts on one principle, static first and dynamic last. Put the persona, standing rules, tool schemas, and large reference documents at the start; move the user's question, RAG-retrieved chunks, and dates to the very end. The classic mistake that defeats all of this is a timestamp or ticket number on the first line of the prompt; it silently kills the cache on every request. Anthropic gives you up to four breakpoints per request, so place cache_control on the last block whose prefix is identical across the calls you want to share a cache.
Batch API: half price for work that can wait
Almost every product has workloads that do not need to finish within a second: embedding backfills, classifying thousands of tickets, overnight document summaries, catalog translation, or labeling evaluation datasets. For all of that, OpenAI's Batch API and Anthropic's Message Batches API sell at half price. The recipe: bundle requests into one file, submit it as a job, and results are guaranteed within a 24-hour window, usually much sooner. OpenAI's format is JSONL, like this:
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions",
"body": {"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Summarize this review in one sentence: ..."}]}}
The flow is three steps: upload the file, create the batch, then poll the status until it completes and download the results. Reserve the batch lane for overnight work and keep the real-time lane for user chat. Besides being cheaper, batches get a separate, more generous processing quota, so they do not fight your live traffic for rate limits.
Stack the two discounts
On Anthropic, the batch discount and caching stack: writing cache inside a batch costs only about 62.5 percent of the normal price, and cache reads inside a batch drop to roughly 5 percent. The documented pattern: send one first request with the shared prefix and a one-hour TTL to warm the cache, then flood the remaining requests as a batch. One honest caveat: because requests inside a batch are processed concurrently in no guaranteed order, cache hits inside a batch are best-effort. For large corpora, the fraction that lands still pays off.
Control the output side: output tokens cost more
The discounts above trim input tokens; do not let output tokens leak money from the other side. On most models, output tokens cost around four to five times more than input tokens. So set max_tokens as a brake, request structured output such as JSON or a compact table instead of long prose, and write explicit instructions in the prompt like "answer in at most three sentences" or "print only the fields that changed." One last rule beginners break most often: never ask the model to print back the entire dataset you just sent it.
Prove it with numbers, not feelings
Once everything is on, verify through the usage fields in the API response. OpenAI reports usage.input_tokens_details.cached_tokens; Anthropic reports cache_creation_input_tokens and cache_read_input_tokens. A quick calculation: a 12,000-token system prompt used 200 times a day means 2.4 million input tokens daily; at the 0.1x cache-read rate, that load drops to an equivalent of 240,000 tokens, a 90 percent cut before you touch a single line of your prompt. Set a budget alert on the dashboard, then compare this week's cost per request against your baseline.
Give it a full week: turn caching on first, move overnight jobs to batch, brake your outputs, then measure. Many teams find 50 to 70 percent savings without changing models; and if you still need more after that, that is the right moment to consider a smaller model.
References
- OpenAI — Prompt Caching Guide — official docs on automatic caching, prompt-length requirements, and cached token discounts.
- OpenAI — Batch API Guide — official guide to 24-hour async jobs at a 50 percent discount.
- Anthropic — Prompt Caching — cache_control mechanics, write vs read pricing, and official TTL options.
- Anthropic — Message Batches API — batch processing docs and how its discount stacks with prompt caching.
- Google — Context Caching (Gemini API) — Google's equivalent explicit caching feature.



