Cloudflare 通过 AI Gateway 公测 Auto Router,按请求分类选模型
Cloudflare’s Auto Router Rates Each Request for Stakes, from the Most Recent Turns
Cloudflare 在 AI Gateway 中公测 Auto Router,把模型设为 cloudflare/auto 后,由分类器为每个请求挑选模型。路由分两阶段:先按请求格式、凭证、计费和额度过滤出候选池,再由 Workers AI 上的多头分类模型在 14 类任务上打分,并从复杂度、歧义、风险、对前文依赖四个维度给请求评 1 到 5 级,按“utility = expected quality - adaptive cost penalty”组合基准结果。分类只读取最近几轮、上限 8 KiB 文本,响应会返回 cf-aig-routed-model 和 cf-aig-routing-reason 便于事后审计,也可用请求头限制候选模型;测试版免费,暂不支持 WebSockets。
正文
Cloudflare recently released Auto Router in public beta through AI Gateway. Set the model to cloudflare/auto, and a classifier picks one per request. The most useful thing in the announcement is a benchmark where Cloudflare’s own router loses.
Routing runs in two stages. AI Gateway first builds a candidate pool, filtering models that cannot serve the request format and applying credentials, billing configuration, access control, and spend limits. A multi-head classification model then runs on Workers AI across Cloudflare’s edge GPUs, assigning probabilities across 14 task categories and rating the request 1 to 5 on four dimensions: complexity, ambiguity, stakes, and dependence on earlier context. A scoring matrix combines those with benchmark results, under the stated formula "utility = expected quality - adaptive cost penalty."
The Auto Router classifies each request from the newest turns only, capped at 8 KiB of text, then scores candidate models on strength by task and expected gain on harder work, with price weighted less as difficulty rises. (Source: Cloudflare blog post)
Jacques B, a CTO working on agentic engineering, named the measure that matters in a LinkedIn post by Cloudflare:
A cheaper model isn’t much of a saving if someone has to spend another hour fixing the result.
Cloudflare published exactly that number. Across 97 tasks with three samples per model and 10,000 bootstrap resamples:
Ten points of reliability for roughly a third of the spend. Teams get to decide which side of that they are on, which is more than most routing products make possible.
The classification itself drew the sharpest practitioner response. Igor Pyrin, a tech lead who has worked on banking and healthcare platforms, noted that stakes are scored from a compact view favoring recent turns:
In a long agent session, the user may say "this is a customer refund" early and later just say "go ahead." I’d carry an application-owned risk label across turns and use it to decide whether the request can use cloudflare/auto at all. A short final instruction should not silently lower the risk classification of the underlying action.
The turn that commits the action is the cheapest-looking turn in the conversation.
Two things the documentation adds. The response carries cf-aig-routed-model and cf-aig-routing-reason, with values like cost_optimal_within_pool and pinned_by_turn, so the choice is auditable after the fact. And the pool is restrictable per request through cf-aig-allowed-models and cf-aig-allowed-providers headers, though not as saved routing profiles, which is what Adam Natad asked for in the launch thread.
Worth checking before trusting the figures: the default pool today lists Claude Opus 5, Sonnet 5 and Fable 5 alongside GPT-5.6 Luna, Sol and Terra, and Grok 4.5. Opus 5.5 and GPT-6 Sol, the two baselines in the table, sit in the opt-in list reachable only through those headers. Cloudflare says the pool "may change over time," so this may be drift rather than design, but a team reproducing the benchmark should confirm what its gateway actually selects.
Session handling carries a cost too. Without a session ID, requests in the same conversation may land on different models and cannot reuse the prompt cache. Cloudflare applies a switching penalty that grows with context length for the same reason, since a new model may redo reasoning tokens at output prices.
On Reddit, commenter reachjalil rejected the premise outright, arguing auto routers "end up costing you more for less intelligence" and that a capable model is cheaper if outcomes matter. Commenter yangqi answered that the unit should be the task, not the request. reachjalil’s follow-up landed on something Cloudflare concedes: classification is itself easier for a large model, and the weights go stale "especially with the constantly changing models." The post says routing weights come from benchmark results, so new models have to be added to the scoring matrix by hand.
Auto Router is free during the beta, with no pricing stated for afterward. WebSockets are unsupported, leaving Chat Completions and the Responses API.
Also on the roadmap is cloudflare/auto-best, same classifier and pool, selecting highest expected quality with no cost tradeoff.