AI
Cloudflare's Auto Router Scores Each Request by Risk to Pick the Right AI Model
Cloudflare launched Auto Router to automatically select between AI models based on task complexity, stakes, and cost—but practitioners worry it may underestimate risk in long agent sessions.
InfoQ
Cloudflare has rolled out Auto Router through its AI Gateway in public beta, a system that intelligently selects which AI model to use for each incoming request. Rather than force users to pick a single model or pay for the most capable one every time, the router evaluates the stakes and context to find an appropriate fit—balancing quality against cost.
How It Works#
The routing process unfolds in two stages. First, AI Gateway filters available models, removing those that cannot handle the request format and applying rules around credentials, billing, access control, and spending caps. Then a multi-head classifier runs on Cloudflare's edge GPUs, analyzing the request across 14 task categories and scoring it on four dimensions:
- Complexity — how difficult the task is
- Ambiguity — how much room for misinterpretation
- Stakes — how much harm a wrong answer causes
- Context dependence — how much earlier conversation matters
These scores, combined with benchmark data, feed into a formula: "utility = expected quality - adaptive cost penalty." Cheaper models carry less weight in the scoring when the stakes are high; expensive models get deprioritized for low-risk work.
The Quality-Cost Tradeoff#
Cloudflare's own testing showed a measurable gain. Across 97 tasks with multiple samples per model, the router achieved roughly ten percentage points higher reliability compared to its cheapest alternative, for about one-third of the spend. That gap matters because, as a Cloudflare engineering lead put it, a cheaper model that produces a wrong answer requiring an hour of fixes isn't actually a bargain.
The system is auditable too: responses include headers like cf-aig-routed-model and cf-aig-routing-reason, so teams can see why each model was chosen.
Emerging Concerns#
Early feedback from practitioners highlights a significant blind spot. In long agent conversations—like iterative refunds or multi-turn workflows—a user might flag something as high-stakes early on ("this is a customer refund") but then later issue a terse command ("go ahead"). The router, analyzing only the most recent 8 KiB of text, may see the final turn as low-risk and route it to a cheaper model, potentially losing the critical context that preceded it.

