Cloudflare says AI code review cost fell 68%: prompt caching and model settings were key
Cloudflare's blog explains how it cut the average cost of its internal AI code reviewer from $2.43 to $0.77 and reviews the effect on quality. Everything below is Cloudflare's own account.
News date: About 7 min read
Contents
What happened
On October 19, 2026, Cloudflare published a blog post by Ryan Skidmore explaining how it reduced the inference cost (the cost of each call to an AI model that produces a response) of its internal AI code reviewer. As Cloudflare describes it, the reviewer uses a coordinating AI agent that dispatches engineers' code changes to multiple specialized reviewers, each covering a different aspect. Cloudflare says the average review cost $1.19 in April and rose to about $2.46 by the end of August, with no major architecture change in between.
Cloudflare says that after optimization, the average review now costs $0.77, down 68% from the $2.43 average of the most expensive two weeks before optimization began. Median review time also fell from 4 min 9 sec to 1 min 32 sec. All figures in this article are Cloudflare's own and have not been independently confirmed by a third party.
Why costs rose and how they came down
Cloudflare says that in early August it moved all reviewers onto Anthropic models, and the cost per job rose from $1.38 to $2.03; tokens (the text units a model processes and bills by) per review also rose from 0.91 million to 2.99 million. According to its explanation, even though the cache hit rate (the share of content that can reuse previously processed material) rose from 85.7% in April to 97% in September, the threefold increase in tokens still pushed costs up.
Prompt caching stores content at the start of a conversation that has already been processed and rarely changes (called the "prefix") so later requests can reuse it; the prefix is stored only up to the position marked by a "cache breakpoint." Cloudflare notes that Anthropic's prompt caching charges 1.25 times the normal input price to write and 0.1 times to read, and that a cache entry expires if it is not read within five minutes. The company found that only 14% to 26% of the first requests in each session found a cached prefix, because OpenCode v1, which the reviewer was running on at the time, put the agent prompt and environment information in one block with a single cache breakpoint at the end, so the portion shared across repositories was never stored separately.
Cloudflare says that on September 16 it added a marker at the end of the agent prompt and used a plugin hook to split the block in two, giving the first half shared by all jobs its own cache breakpoint; the same day it also put the reference index needed by the Codex reviewer, which checks internal standards, directly into the prompt. These changes brought the cost per review down from $2.47 to $2.02.
A later batch of changes on September 21 and 23 included: removing tools that sub-reviewers (the specialized reviewers under the coordinating agent) could not use, reading files in parallel, skipping some reviewers on re-reviews, stopping once a review is posted, and detecting and stopping jobs that had been cancelled. Cloudflare says these together saved about $0.20 per review.
| Item | Figure reported by Cloudflare |
|---|---|
| Average cost per review | Down from $2.43 to $0.77 (-68%) |
| Median review time | Down from 4 min 9 sec to 1 min 32 sec |
| Share of the $1.67 reduction from code changes | $0.65 |
| Share of the $1.67 reduction from model and effort | $1.06 |
| Share of reviews longer than five minutes | Down from 37.9% to 0.7% |
Model and effort adjustments
Cloudflare says that starting October 3 it split the Sonnet reviewers 50/50 between Sonnet 5 and Sonnet 5.5. Two and a half days later, Sonnet 5.5 cost 62%, 58% and 47% less per run for the code quality, performance and security reviewers respectively. The two models have the same per-token price, so the savings came entirely from using fewer tokens; on October 5 everything moved to 5.5.
"Effort" is a setting that controls how much work the model puts into each task, with levels such as medium and high. Cloudflare says the code quality reviewer at high effort costs 61% more per run than at medium but posts 58% more findings at critical and warning levels, so it decided to switch to high effort, and the cost figures in the article assume this.
Did quality suffer?
Cloudflare says the code quality reviewer at high effort produces 40% fewer critical and warning findings than at the end of August, yet the share of its serious (critical and warning) findings that authors actually acted on by changing code rose from 34% to 59%. In a blind evaluation using models from two different providers, important findings per review went from 0.28 to 0.30, with overlapping intervals; findings rated as overstated in severity fell from 0.46 to 0.14.
However, Cloudflare also says the performance reviewer lost real findings (judges rated important performance issues per review as about 64% fewer), while the security reviewer had about a quarter fewer but the difference was not statistically significant; both remain at medium effort, and the next step is testing high effort. The company admits its method is imperfect: an author changing a flagged line does not mean the finding was correct, the judges are themselves models, each group had only 35 to 66 findings, and the "now" time window was only one day.
What this means for general readers
The article shows that the cost of an AI agent depends not only on the model's unit price but also on how much content is sent with each call and whether the cache is actually hit. For general readers, this means the running cost and response speed of AI-assisted tools can be heavily affected by the engineering behind them. Cloudflare advises that anyone running agents at comparable scale should first check whether the first request of each session is really read from the cache, and whether the reviewers can still find real problems at the effort level being paid for.
Frequently asked questions
How was the 68% reduction calculated?
Cloudflare says it compares the current average of $0.77 with the $2.43 average of the most expensive two weeks before optimization began. This figure is published by Cloudflare itself.
Did costs fall because reviews became sloppier?
Cloudflare says the code quality reviewer at high effort produces a similar number of important findings as before, and what decreased was mainly noise and inflated severity. But it also admits the performance reviewer lost real findings, the security reviewer may have as well, and the evaluation has limits such as small samples and model judges.
Have these results been confirmed by a third party?
No. The figures come only from Cloudflare's own blog and should be treated as Cloudflare's claims, not independently verified results.
What role does prompt caching play here?
Cloudflare says it found that the first request of most sessions did not hit the shared cached prefix; after fixing the prompt structure, costs dropped noticeably, and it calls this the single largest saving.
Found this guide helpful? Share it with someone who needs it
Google Cloud: AlloyDB Omni Can Call Local Models Like Gemma 4 and Qwen3.8 Directly from SQL
Google Cloud says PostgreSQL-compatible AlloyDB Omni can now integrate with locally hosted large language models, keeping prompts, data and responses in your own environment. The official walkthrough uses GKE and Ollama.
Cloudflare WAF Blocks Ruby ruby2shell (CVE-2026-132825) by Default on All Plans, Including Free; Upgrading to 3.3.14, 3.4.13 or 4.0.10 Is Still Required
PHP2Shell: Two Critical PHP Flaws (CVSS 9.2) Are Patched, but Dell Says You Should Also Rotate Credentials and Validate Backups
Google Cloud IAM Unified Access Policies Now in Preview: One Policy Can Bind Up to 25 Targets at No Extra Charge
Sources
Compiled from the references and verification dates listed above; fares, schedules, product features, and terms can change, so please confirm the latest details on the relevant official website before travelling, booking, or purchasing.