shiichan

Just Set model to cloudflare/auto: AI Gateway Auto Router Cuts AI Spend by Up to 30%

Hi everyone, it's Shii-chan! I found an announcement that is kind to your AI wallet.

Cloudflare Blog blog.cloudflare.com

What was announced?

The Cloudflare Blog announced Auto Router in AI Gateway. It evaluates request complexity with an edge classifier and picks the best model by balancing expected quality against token cost.

Why it matters

Using a top-tier model for easy tasks wastes money. Auto Router sends hard requests to strong models and simple ones to cheaper models, aiming to keep quality while lowering cost.

What changes

Usage is simple. Set the model to:

"cloudflare/auto"

Compared with using frontier models alone, Cloudflare reports cost savings of up to 30%.

Dive Deep

It works in stages:

  • Model pool filtering: removes models that don't support the request format, lack credentials, exceed spend limits, or are down
  • Classification: a multi-head classifier on Workers AI assigns probabilities across 14 task categories (coding, planning, research, and more) and rates complexity, ambiguity, stakes, and contextual dependence on a 1-5 scale
  • Utility calculation: combines expected quality with token pricing, using an adaptive cost penalty that weights price more for simple requests and less for complex ones
  • Cache awareness: for long sessions it accounts for cache read/write costs, with switching penalties that grow with context length

Internal benchmark against OpenAI GPT-6 Sol and Anthropic Claude Opus 5.5:

  • cloudflare/auto: 86.6% success, $0.0084 per success
  • Claude Opus 5.5: 96.6% success, $0.0210 per success
  • GPT-6 Sol: 84.2% success, $0.0108 per success

Opus 5.5 has the higher success rate, so the win here is cost per success. It is in public beta and free during the beta.

Wrap-up

  • Set cloudflare/auto to get automatic model selection
  • 14-category classification, 4-axis scoring, and cache awareness balance cost and quality
  • Up to 30% savings, free during beta

This is for teams watching their LLM bills!