Cut your AI spend with AI Gateway's Auto Router

Cloudflare has released its Auto Router in public beta, available through AI Gateway. Developers point their model setting at cloudflare/auto, and the gateway routes each request to a model judged capable enough for the task, so end users do not select models themselves. In internal use through Cloudflare's OpenCode harness, early results showed cost savings of up to 30% compared with using only frontier models such as OpenAI Sol and Anthropic Claude Opus. The feature is free while in beta.
The motivation is organizational rather than purely technical. Cloudflare describes a common pattern: teams start in an exploration phase with freely distributed API keys and heavy token use, then converge on canonical tools for agentic coding, non-technical workflows and agent deployment. In harnesses including OpenCode, Claude Code and Codex, individuals still pick models manually, and Cloudflare argues people often reach for models that are overkill, such as Opus-level intelligence for summarizing email or chat threads. Blocking such models outright would penalize teams like security engineering that genuinely need them. Cloudflare's stated goal is for AI Gateway to act as the control plane for internal AI deployments, since every request from every user, agent and tool already passes through it. Budgets, spend limits and identity-aware analytics provide guardrails, but still depend on individuals making cost-conscious decisions request by request; the router moves that decision into the gateway itself.
The published numbers come from an internal general knowledge work benchmark using simulated workspace tools across email, calendars, Slack, files, travel and finance, where each task requires tool use to produce a verifiable answer or action. There were 97 tasks with three samples per model per task, 291 trials in total. cloudflare/auto succeeded on 252 of 291 trials, an 86.6% rate, at a total cost of $2.10 and $0.0084 per success. Anthropic Claude Opus 5.5 reached 281 of 291, or 96.6%, at $5.91 total and $0.0210 per success. OpenAI GPT-6 Sol reached 245 of 291, or 84.2%, at $2.64 total and $0.0108 per success. Confidence intervals shown in the table are 95% intervals estimated from 10,000 task-level bootstrap resamples preserving all three repetitions per task. Cloudflare says the router came in at 80% the cost of Sol and 35% the cost of Opus. My reading of those figures is that the router traded roughly ten points of success rate against Opus for a bit over a third of the per-success cost, while edging out Sol on both accuracy and price in this particular benchmark.
Cloudflare frames the problem through what it calls the jagged frontier across models: the ability to solve a given problem often exists somewhere in the portfolio, and the router's job is to pick the right model while balancing quality and price. Two further points from the post are worth noting for anyone reasoning about routing economics. First, savings come from not paying frontier rates for non-frontier work, so they scale with how much such work an organization has. Second, lower token prices do not automatically mean lower-cost outcomes, because a nominally cheap model may consume disproportionately more tokens; Cloudflare argues a router should minimize predicted trajectory cost rather than load-balance on dollars per million tokens.
Mechanically, a request to cloudflare/auto first builds a pool of models that can actually serve it. The gateway filters out models that do not support the request format or execution mode, and accounts for credentials, billing configuration, access control policies and spend limits attached to the gateway. Unhealthy upstream providers or models are excluded during downtime and automatically returned to the pool afterward. For the survivors, the router takes a compact view of the conversation, prioritizing the newest turns. That view goes to a multi-head classification model running on Workers AI and deployed on GPUs across Cloudflare's edge network. The classifier emits two sets of signals: probabilities across 14 task categories such as coding, planning, research and data analysis, and ratings from one to five on four dimensions, namely complexity, ambiguity, stakes and dependence on earlier context.
A separate scoring matrix combines those signals with model benchmark results to estimate fit. Cloudflare calibrated the matrix by defining the preferred model for a set of example task and difficulty profiles, then adjusting weights until the matrix produced those choices. The router then combines expected quality with each model's input and output token prices. On straightforward requests price carries more weight, so a smaller model can win when it is capable enough; as difficulty rises the cost penalty falls and stronger models have more room. In simplified terms, cloudflare/auto picks the model with the highest utility, defined as expected quality minus an adaptive cost penalty.
Caching gets explicit treatment, which is the part most likely to matter in practice for long agentic sessions. In extended debugging or coding runs, cost is driven less by list price than by cache reads, which grow with session length; switching models discards the cache and forces a new model to write the whole context again. Cloudflare says that can still pay off if the new model's cache-read and cache-write prices are low enough to recover the rewrite quickly, so the router prices the trade rather than forbidding it. Within a turn, one user input loop, the cache is hot and switching rarely pays off. Across turns it applies a switching penalty that grows with tokens already in context; a model holding a live cache for the session is priced at its cheaper cache-read rate, while every other candidate is charged the full rewrite cost. The deeper the conversation, the more a switch must earn back through better quality that yields fewer tokens overall or cheaper cache rereads. A related cost is reasoning tokens: most models cannot read another model's reasoning, so a switch that drops them may force the new model to redo that work at output prices. Cloudflare says it wants the router to prefer staying within the same model family when it switches. The router returns a ranked list, and AI Gateway attempts the winner first, falling back to another eligible model if that provider cannot serve the request.
Cloudflare highlights two design properties. The two-stage architecture, classifier then scoring matrix, keeps decisions legible, because the predicted task category and complexity can be inspected to see how a model choice followed. And adding a newly released model does not require retraining; its benchmark-derived weights are simply added to the scoring matrix. The same classifier is intended to support other routing profiles, including a planned cloudflare/auto-best that uses identical classification and model pool but selects for highest expected quality without the cost tradeoff.
Near-term plans include expanding the models offered through cloudflare/auto, factoring zero-data-retention requirements into model filtering, accounting for provider capacity during selection, choosing an appropriate reasoning or thinking level per request, adding full support for the Responses API and WebSockets, and exploring structured decision models as a first-pass classifier. Cloudflare credits Mats Dodd, Sam Scott, Oliver Yu and Jeff Rafter as contributors.
Why it matters: Teams running agents through AI Gateway can now trade a small amount of measured accuracy for substantially lower per-task cost without asking users to change how they work, which is most attractive where work spans both technical and non-technical tasks. The switching and cache accounting is the detail to watch in practice, since my inference is that routing gains will be smaller in long, cache-heavy coding sessions than in short knowledge-work requests. The benchmark is Cloudflare's own internal evaluation, so independent comparisons and the promised additions such as provider capacity, zero-data retention filtering and Responses API support are the things to track before treating it as a default in production.
Based on reporting from the original publisher. Visit the source for full context and later updates.
Publisher excerpt
Cloudflare AI Gateway now features a model router that evaluates request complexity using an edge-deployed classifier to select the optimal model. By balancing expected output quality against token costs, organizations can dramatically cut AI spend while maintaining performance.