One control plane for model traffic
AI Gateway and Workers AI began as separate products, but the line between them has been blurring. AI Gateway proxies requests to any model provider, handling observability, logging, security, and access. Workers AI hosts models on managed GPU infrastructure behind an API endpoint. Both ultimately do the same job: connecting you to models through a sophisticated control plane. Cloudflare is now formally merging these paths so that traffic to Workers AI and external providers can be governed from a single interface.
Unification starts at the entry points. The AI Workers binding and the REST API already route to both products without a separate binding for each. A default gateway, introduced earlier this year, automatically applies AI Gateway observability and logging to calls even if you never explicitly created a gateway. Named gateways remain available for splitting traffic across projects or applications. A binding call to Workers AI through AI Gateway looks like the following:
export default {
async fetch(request, env) {
const response = await env.AI.run(
'@cf/zai-org/glm-5.2',
{
messages: [
{ role: 'user', content: 'What is the capital of France?' },
]
},
{
gateway: {
id: 'default', // Use 'default' for the built-in gateway
},
}
);
return new Response(JSON.stringify(response), {
headers: { 'Content-Type': 'application/json' },
});
},
};
The REST API has converged as well, with a unified /ai/ endpoint handling calls to Workers AI via AI Gateway:
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/@cf/zai-org/glm-5.2" \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
-H "cf-aig-gateway-id: default" \
-d '{
"messages": [{"role": "user", "content": "What is the capital of France?"}],
}'
This removes the need to decide which product to start with: the default integration comes with full control-plane capabilities included.
Observability without setup
The immediate effect of this convergence is visibility by default. If you've never configured a gateway, simply pass default as the gateway ID in your binding or REST API calls. AI Gateway creates the gateway automatically on the first authenticated request. You then get full request and response payload logging, per-model token counts, and cost attribution with no dashboard configuration.
Previously, calling Workers AI directly looked like this in the binding:
const response = await env.AI.run('@cf/zai-org/glm-5.2', {
messages: [{ role: 'user', content: 'Hello!' }],
});
Now, a third argument routes the call through AI Gateway and enables complete observability:
const response = await env.AI.run(
'@cf/zai-org/glm-5.2',
{ messages: [{ role: 'user', content: 'Hello!' }] },
{ gateway: { id: 'default' } } // Auto-creates the gateway on first use
);
On the AI Gateway dashboard, you'll see latency breakdowns, token usage, error rates, and the exact prompts and responses for every request. If you later outgrow the default gateway — say, you want custom caching rules or per-application traffic splitting — you can create a named gateway and change a single parameter to point requests at it.
Unified billing with AI Gateway credits
A new capability rolling out today: AI Gateway credits can now be applied to Workers AI usage. Previously, credits were restricted to external providers like OpenAI and Anthropic. Now you can load a wallet full of credits and spend them across OpenAI, Anthropic, Workers AI, or any other supported provider.
Alongside this pre-paid billing path for Workers AI, Cloudflare is offering elevated rate limits on Workers AI models when you use AI Gateway unified billing. Consult the developer documentation for current rate limit details and instructions on requesting higher limits.
Routing by model, not provider
With inference traffic flowing through one control plane, routing can become model-first instead of provider-first. Today, you must know which provider hosts a model, and your application breaks if that provider goes down or imposes rate limits. The planned shift: you specify the model, and the gateway handles provider selection, failover, and load balancing.
For example, you could request Kimi K2.7 Code without caring whether it's served from Workers AI, Moonshot's own API, or another provider hosting the same weights. If Workers AI has spare capacity, you benefit from its managed infrastructure. If it's at capacity, the gateway transparently routes to another provider that can serve the same model. You can still pin to a single provider if you prefer, but model-first routing gives you resiliency options without application-level fallback logic. Providers are vetted for output quality, and requirements such as Zero Data Retention (ZDR) can be respected.
curl -X POST "https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1/chat/completions" \
-H "Authorization: Bearer {api_token}" \
-H "cf-aig-gateway-id: my-gateway" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.7-code",
"messages": [{"role": "user", "content": "Review this function"}]
}'
If one provider's version of a model is having issues, traffic shifts elsewhere automatically — no retries or complex routing code in your Workers. This pilot is expected in the coming months for all AI Gateway and Workers AI users.
Smart routing on the way
Beyond failover, Cloudflare is building intelligent routing that picks the right model for a request without explicit configuration. A classifier running on Workers AI reads the prompt and predicts task type (coding, research, summarization, general Q&A), complexity, and context importance. A heuristic scorer maps those predictions to the best model from a curated pool. Teams that need control can still specify exact models; the zero-config path offers better economics and performance without maintaining routing logic. Internal pilots are underway, with active testing and iteration expected over the next few weeks before release.
Get started now
Existing Workers AI users can start by routing calls through a default gateway — no other changes required. You'll immediately get request logging, token tracking, and cost attribution. Existing AI Gateway users can add Workers AI to the mix simply by calling a Workers AI model.
To try it out, set up your first gateway and browse the Workers AI model catalog.




