Cut your AI spend with AI Gateway's Auto Router
- Source
- blog.cloudflare.com
- Date
Auto Router is Cloudflare's answer to a common problem: users and agents default to the most expensive model even for simple requests. Instead of writing routing rules by hand, you point traffic at cloudflare/auto and an edge-deployed classifier judges each request's complexity, then picks a model that trades expected output quality against token cost. Cloudflare says it runs the router behind its own Claude Code, Codex and OpenCode usage and saw savings of up to 30%. That number is internal and self-reported, so the useful move is to test it on your own traffic and compare quality, not just spend. The release pairs with User Insights, a free AI Gateway view that breaks usage down by task, model and user, which gives you the evidence to check whether the router is sending the right work to the cheaper models. Both features are in beta.

Context
Cloudflare's Auto Router, in public beta through AI Gateway, chooses a model for each request by estimating what the task needs and weighing that against price. It first removes models that cannot handle the request or conflict with the gateway's access and spending rules. It then classifies the task and scores the eligible models, including the cost of moving a long conversation from one model to another. This lets an organization automate model selection instead of relying on each user to pick. Cloudflare explains the routing process.
Cloudflare's own shows a tradeoff. On an internal of simulated workplace tasks (97 tasks, three attempts each, 291 trials per model), the router succeeded in 252 trials at a total cost of $2.10. Anthropic's Claude Opus 5.5 succeeded in 281 trials at $5.91, and OpenAI's GPT-6 Sol in 245 trials at $2.64. The cheaper route therefore completed fewer attempts than Opus, and this is the company's benchmark rather than independent testing. Evaluation results.
- On Cloudflare's internal knowledge-work benchmark (97 tasks, three samples each), cloudflare/auto succeeded 86.6% of the time for $2.10, versus 96.6% at $5.91 for Claude Opus 5.5 and 84.2% at $2.64 for GPT-6 Sol. Cost per success: $0.0084, $0.0210, $0.0108.
- The router first filters models by request format, credentials, access policies, spend limits and provider health. A Workers AI classifier then reads recent turns, scores 14 task categories, and rates complexity, ambiguity, stakes and dependence from 1 to 5.
- A scoring matrix combines those signals with model benchmarks and prices. Price weighs more on easy requests and the cost penalty shrinks as difficulty rises. Adding a new model needs only its benchmark-derived weights, not retraining.
- Switching models discards the prompt cache, so the router avoids switching within a turn and applies a cross-turn penalty that grows with tokens in context, pricing the current model at its cache-read rate and every other candidate at the full cost of rewriting context.
- Cloudflare argues cheaper per-token models do not always give cheaper outcomes, since some use far more tokens, so a router should minimize predicted trajectory cost. A planned cloudflare/auto-best will pick the highest expected quality without the cost tradeoff.
- eval — A repeatable test for AI quality — a set of tasks plus scoring — used the way software teams use test suites, because model output is too variable to judge by eyeballing.
- benchmark — A standard public test set for comparing AI models — the shared scoreboards behind every "model X beats model Y" claim.
- context window — The maximum amount of text a model can consider at once — its working memory for the current conversation or task.
- token — The chunk of text a model reads and writes in — roughly three-quarters of a word — and the unit AI usage is billed in.
Checking sign-in…
Loading comments…


