Cutting our inference bill by 68% by being obsessive about optimization
Photo: Logg Tandy / CC BY 4.0 · via Wikimedia CommonsEditorial summary · not verbatim

Cloudflare has described how its AI code reviewer's cost per run doubled, prompting engineers to examine token usage and ultimately cut the inference bill by 68% while making reviews faster. The case study is a useful counterweight to the assumption that AI costs fall mainly through cheaper models: much of the saving came from sending fewer and better-chosen tokens.

advertisement

Two techniques did most of the work. Prompt caching let repeated context, such as repository instructions and file headers, be reused instead of resent on every call, and intelligent routing sent simple requests to smaller models while reserving the largest model for changes that needed deeper reasoning. Both preserve output quality if the routing thresholds are set with care.

The economic lesson is that unit cost and total cost diverge. A team can negotiate a lower price per token and still see spend rise if prompts grow or volume doubles. Conversely, a modest engineering effort on context management can outweigh a favourable contract, which is why inference optimisation is increasingly an application concern rather than a procurement one.

This kind of disclosure is becoming common as companies move AI features from pilot to production and the bills arrive. The patterns repeat: prompt bloat, redundant context, over-reliance on the largest model, and evaluation suites that measure quality without measuring cost per answered request. Procurement teams rarely see those numbers, which is why optimisation often starts late.

The limit is quality regression, which shows up late and quietly. Routing rules that look safe in testing can degrade edge cases that nobody sampled, and caching can serve stale context after a repository changes. The open question is whether teams build evaluation that catches those failures before customers do. A 68% saving is easy to celebrate; a 5% quality drop is easy to miss.

Source & provenance

Original headline: Cutting our inference bill by 68% by being obsessive about optimization
Publisher: Cloudflare Blog · Published: October 19, 2026

This page is an original English summary written for Gridline Cloud. It is not a verbatim reproduction and does not claim to represent the full article. Headline, publication date and link were collected from the publisher's RSS feed.

Cover photograph: Connection Machine CM-2 and DataVault at The Mimms Museum of Technology and Art.webp by Logg Tandy, licensed CC BY 4.0, via Wikimedia Commons.

Read the original at Cloudflare Blog →