One chat. Automatic model selection.
Ask a question. Cloudflare AI Gateway Auto Router chooses a Workers AI model for the task.
Every message uses cloudflare/auto. No model picker, no API keys in your browser.
Try the chat
Demo prompts and answers are logged in Clark's Cloudflare account for demonstration. Please do not enter secrets or personal information. AI answers can be inaccurate.
Ready. Every request goes through Auto Router.
Chat history and a random session ID stay in this tab and are not saved in browser storage. The ID groups requests in the gateway logs; it does not identify you. New chat or reloading the page starts a new session, but does not erase gateway logs. Each message still gets a fresh routing decision, which may choose the same model.
Recent AI traffic
Public model counts across the latest 24 hourly buckets, including the current partial hour. Times are UTC.
No requests in this window yet. Try the chat to create the first sample.
Requests over time
Which models were used?
| Model | Requests | Share |
|---|
Loading aggregate usage statistics...
Only hourly model counts are published. No prompts, answers, session IDs, or visitor details are exposed. Counts include demo/test traffic and bounded automatic retries, not unique visitors; historical gateway logs seed the chart and new inference attempts update it. Errors without a reported model appear as unreported. Percentages are rounded.
How Auto Router works, step by step
- You send a message. The page sends your prompt and recent conversation to a Cloudflare Worker on this website.
- The Worker calls AI Gateway. It validates the request, applies a per-visitor rate limit, and asks for
cloudflare/autorather than a specific model. Credentials stay on Cloudflare. - The gateway checks the model pool. Only our allowed Workers AI models are considered. Unsupported inputs, unavailable providers, and account or spending restrictions can make a model ineligible.
- Auto Router evaluates the task. It classifies the conversation's task and difficulty, then ranks eligible models by expected response quality and cost.
- A model generates the answer. The gateway tries the top-ranked candidate and can fall back to another eligible model if it cannot serve the request. This demo requests a fresh routing decision for every message.
- You see the reply; we see the request. The Worker returns the answer and routing details to the chat. AI Gateway records the prompt and response for inspection in the dashboard. Response caching is skipped in this demo.
Read the Auto Router documentation · View the AI Gateway + OpenCode architecture
Why use Auto Router?
It's not just cost control. The goal is to balance expected answer quality and cost for each task, rather than always using the cheapest model or always paying for the most capable one.
Match the model to the task
A quick explanation and a difficult coding problem may need different capabilities. Auto Router estimates the task's difficulty and chooses a suitable model from the eligible pool. These are predictions, not fixed rules or guarantees of answer quality.
Avoid unnecessary model spend
When a lower-cost model is expected to handle a task well, using a more expensive model may add little value. Routing considers that tradeoff. Separate gateway rate limits and spending budgets provide additional controls; Auto Router itself is not a hard budget cap.
Keep requests moving
The gateway excludes unhealthy providers and can try another eligible model if the selected candidate cannot serve the request. This improves resilience, but requests can still fail if no suitable candidate is available.
Simplify your application
Your app asks for cloudflare/auto instead of maintaining its own model-selection logic. You still control which models and providers are allowed. In this demo, every request stays within the supported Workers AI chat pool.
How does Cloudflare decide?
First, it filters for models that can accept the request and are available under your credentials, billing configuration, and spend limits. Then it analyzes the conversation's task type and difficulty, scores the eligible models by expected quality versus cost, and tries the top-ranked candidate. If that candidate cannot serve the request, it can try the next one.
The public documentation explains this process, but does not publish the exact scoring formula. It is not random selection, round robin, or a promise to pick the cheapest model. The routing reason shown beneath each reply helps explain what happened; evaluate the answers and gateway logs against your own application's needs.