LIVE · Thursday 3 December

How to Reduce LLM API Costs: Prompt Caching, Batch API and Model Routing, Priced on One Workload

Caching, batch and trimming are documented discounts that multiply; routing and small custom models can save more but only your own eval can say how much. A worked example at November 2026 list prices shows how far each lever goes.

By Nick9 min read

To reduce LLM API costs, turn on prompt caching with a stable prompt prefix, move any work nobody is waiting on to the Batch API or flex processing, trim prompts, tool definitions and output, and then route simple requests to a smaller model. Caching and batch have published discounts (cache reads at 0.1x the input price or less, batch at 50 percent off on both Anthropic and OpenAI), and Anthropic says the two stack. On a worked example priced at Anthropic's November 17, 2026 list rates, those three levers cut the cost of 1,000 tasks on Claude Opus 5.5 from $42.00 to $6.56; routing most of the remainder to Claude Haiku 5.5 takes it to $2.73, but only if the smaller model passes your own eval.

Your bill is three numbers multiplied

Every API bill reduces to one formula: number of calls, times tokens per call, times price per token. Each cost lever attacks one of those factors, which is why they compound rather than add. Halving the price per token and then cutting a third of the tokens leaves you paying a third of the original, not nothing.

The levers map cleanly onto the formula. Prompt caching and batch processing lower the price per token without changing what you send. Trimming prompts, pruning tool definitions and capping output lower the tokens per call. Model routing and a small model trained on your own traffic lower the price per token again, this time by changing who answers. OpenAI's cost optimization guide names the same three moves in plain terms: "Reduce requests", "Minimize tokens" and "Select a smaller model".

One caveat makes the price-per-token factor harder to compare than it looks. Anthropic's pricing page says Claude 4.7 and later models use a newer tokenizer that "produces approximately 30% more tokens for the same text," with the exact increase depending on content. A lower price per million tokens on one model can still mean a higher bill if the same text becomes more tokens. The only fair comparison is cost per task: what one finished unit of work costs on your real prompts.

Caching: the cheapest discount to collect

Caching works because most production prompts repeat themselves. The system prompt, the tool definitions and any reference text are identical on every call; only the user's input changes. Providers store the processed prefix and charge a fraction of the input price to reuse it.

Anthropic's pricing page sets a cache write at 1.25x the base input price for the five-minute cache and 2x for the one-hour cache, with reads at 0.1x on most models. Its newest models are cheaper still: cache hits cost 0.05x on Claude Opus 5.5 and Sonnet 5.5 and 0.025x on Claude Fable 5.2. The page says the five-minute cache pays for itself after one cache read and the one-hour cache after two. The caching docs set the minimum cacheable prompt at 512 tokens on the current models (1,024 on Sonnet 4.6 and 4,096 on Haiku 4.5), and warn that shorter prompts are processed without caching and "no error is returned."

OpenAI turns caching on for you. Its prompt caching guide says it "is enabled by default for supported OpenAI models," with a 1,024-token minimum on GPT-5.6 and later and cached input "discounted up to 95%": reads cost 0.1x the input rate, or 0.05x on GPT-6.2 Astra, GPT-6.2 Sol, GPT-6.1 Sol and GPT-6.1 Terra. The guide also says writes on GPT-5.6 and later now cost 1.25x the uncached rate for a 30-minute lifetime or 2.5x for 12 hours, so caching on OpenAI's newest models is no longer free when it misses.

The practical rule on both platforms is order. Anthropic builds its cache prefix from tools, then system, then messages, and changing a tool definition invalidates all three. OpenAI's guide says to "put stable developer instructions and shared reference material first" and push timestamps and user-specific content to the end. A timestamp at the top of a system prompt is enough to make every call a miss.

Batch and flex: half price for work that can wait

Anything a user is not watching, such as evaluations, enrichment jobs, overnight reports or bulk classification, does not need real-time pricing. Anthropic's Batch API gives "a 50 percent discount on both input and output tokens"; its docs say most batches finish in under an hour, and requests that have not run within 24 hours expire unbilled. OpenAI's Batch guide offers a "50% cost discount compared to synchronous APIs" with a 24-hour completion window, and batch jobs don't count against standard rate limits.

OpenAI also sells flex processing, a middle ground for requests that can tolerate "slower response times and occasional resource unavailability." Its docs say flex tokens "are priced at Batch API rates," but flex is in beta with limited models: the pricing page lists no flex rate for gpt-6.2-sol, for example. When flex lacks capacity it returns a 429 error, and "you will not be charged." A third option, background requests, is priced 30 percent below Standard for a two-hour window and 40 percent below for an eight-hour window on GPT-6.2 Astra, GPT-6.2 Sol, GPT-6.1 Terra and GPT-6 Luna.

Batch and caching combine, with a catch. Anthropic's pricing page says "Batch API and prompt caching discounts can be combined," but its batch docs add that cache hits in batches are "best-effort" and that users "typically experience cache hit rates ranging from 30 percent to 98 percent." The docs suggest the one-hour cache for batches that share context.

Trimming: fewer tokens per call

Trimming is the lever with no published multiplier, because the saving is whatever you remove. Output is usually the place to start: on Claude Opus 5.5 an output token costs $20 per million against $4 for input, so a cap on max_tokens and a request for structured output pay back five times faster than the same cut on the input side.

Tool definitions are the hidden cost. Anthropic's pricing page says declaring its browser-use toolset adds about 6,600 input tokens to every request and the computer-use toolset about 4,500, on top of a 286-token tool-use system prompt on the current models. An agent that sends twenty tools on every call when it needs three is paying for the other seventeen each time.

A worked example, lever by lever

No published source measures cost per task, eval score, median latency and time to first token for each of these levers on one production workload, alone and stacked; the figures below are arithmetic on list prices, not a measurement, and the effect of each lever on eval score, median latency and time to first token on this job has not been measured. They show how the multipliers interact once real token counts are fixed.

The assumed job: 1,000 tasks, each sending a 6,000-token stable prefix (instructions, tool definitions, reference text), 1,500 tokens of task-specific input, and receiving 600 output tokens. The model is Claude Opus 5.5 at $4 input and $20 output per million. For caching, assume a steady stream that writes the five-minute cache once per 100 tasks. For trimming, assume pruning tools cuts the prefix to 4,500 tokens, tighter retrieval cuts task input to 1,000, and an output cap brings answers to 400 tokens. For routing, assume 60 percent of tasks pass the eval on Claude Haiku 5.5, which shares the newer tokenizer, so token counts carry over.

Lever Alone, per 1,000 tasks Stacked, per 1,000 tasks
Baseline (Opus 5.5) $42.00 $42.00
Prompt caching $19.49 (-54%) $19.49 (-54%)
Batch API $21.00 (-50%) $9.74 (-77%)
Trimming prompts, tools, output $30.00 (-29%) $6.56 (-84%)
Routing 60% to Haiku 5.5 $17.43 (-59%) $2.73 (-94%)

Three things stand out. First, caching does as much as batch on this job because input is most of the bill: 7,500 input tokens against 600 output. A job dominated by long answers would get less from caching and more from trimming output.

Second, the stack depends on the hit rate. At the low end of Anthropic's batch range, 30 percent, every miss pays the 1.25x write premium, and the batched, cached job costs $19.68 per 1,000 tasks, barely below batch alone at $21.00. Measure your actual hit rate before counting on the stacked number.

Third, the last row carries the most assumption. Routing alone cuts more than caching alone, but the 60 percent pass rate is invented for the example; the true share is whatever your eval says it is. The arithmetic also ignores the cost of making the routing decision and of warming a second cache.

Where routing stops and a custom model starts

Routing picks the cheapest existing model that can handle each request. Its savings are capped by how much of your traffic the cheap model can already do well. Anthropic's own advice is to "Choose Haiku for simple tasks, Sonnet for most production workloads, and Opus for the most complex reasoning," which is routing by hand. One caution on Anthropic's cheapest tier: Claude Haiku 5.5's price rises from $0.10 input and $0.50 output to $0.50 and $2.50 per million once a prompt passes 100,000 tokens, and cached tokens count toward that length, so routing long-context requests to it saves far less.

The next step is to make the small model better at your task instead of hoping it already is: post-train a compact model on the traffic you already send, and keep the frontier model as a fallback. That only makes sense for a narrow, repeated task (classification, extraction, a fixed-format answer), enough production traffic to learn from, and an eval you trust to say when the small model is good enough.

Parsec, a small language model lab, sells this as a managed service. Its inference page describes a loop that traces production requests, builds datasets and evaluations the customer approves, trains with SFT or LoRA, and serves the result, sending requests the custom model is not confident on to a closed frontier model. Its comparison page claims "savings on real workloads" of 60 percent against "typical router savings" of 15 percent, but defines no workload or baseline for either figure, and Parsec publishes no price for the service. The page says customers own their Parsec models.

The order to do it in

Effort and savings line up well. Caching is a prompt reorder and a flag; batch is a queue for jobs that already run offline; trimming takes measurement; routing and custom models take an eval and real engineering.

  1. Move everything stable to the front of the prompt and confirm that calls are actually hitting the cache.
  2. Send every job no user waits on to batch or flex, and use the one-hour cache for batches with shared context.
  3. Cap max_tokens, ask for structured output, and send only the tools each call needs.
  4. Track cost per feature, not per million tokens, so tokenizer differences don't hide.
  5. Build an eval from real traffic, then test a smaller model on it before routing anything.
  6. If one narrow task dominates the bill, price a model trained on that task against routing.

Bottom line

If you do nothing else, cache a stable prefix; it is the largest discount for the least work on any prompt-heavy job. If work can wait, batch it, and check the hit rate before counting on the stacked discount. If output dominates, trim output first. Route to a smaller model only after it passes your own eval, and consider a custom small model only when one repeated task with plenty of traffic carries most of the spend.

Sources

More in Products

All Products →