On August 7, Cloudflare merged Workers AI and AI Gateway into a single control plane. If you use either product, the immediate upshot is practical: your AI calls can share one credit wallet with OpenAI and Anthropic, and your Workers AI frontier model rate limits jumped from 20 to 50 requests per minute. The cost of entry is adding one parameter to your code.
What Actually Changed
Before this update, Workers AI and AI Gateway were two separate systems with separate bindings and separate billing. Workers AI ran Cloudflare-hosted models on edge GPUs. AI Gateway proxied external providers like OpenAI and Anthropic with observability and spend controls. The two never shared a credit pool, and Workers AI had no gateway-level observability by default.
Now both products route through the same env.AI.run() binding. Pass a gateway ID and you get unified billing, logging, and rate-limit upgrades in one shot. The default gateway auto-creates on your first authenticated request — nothing to provision in the dashboard.
| Before | After | |
|---|---|---|
| Workers AI billing | Separate system | Unified wallet |
| AI Gateway scope | External providers only | External + Workers AI |
| Frontier model rate limit | 20 req/min | 50 req/min |
| Observability (Workers AI) | None by default | Yes, via gateway |
| Workers Paid plan required | Yes, for frontier models | No (unified billing) |
The Migration Is One Line
For existing Workers AI users, the entire migration is adding { gateway: { id: "default" } } to your env.AI.run() calls:
// Before: direct Workers AI call, no observability
const response = await env.AI.run(
"@cf/zai-org/glm-5.2",
{ messages: [{ role: "user", content: "Hello!" }] }
);
// After: add one parameter to route through the gateway
const response = await env.AI.run(
"@cf/zai-org/glm-5.2",
{ messages: [{ role: "user", content: "Hello!" }] },
{ gateway: { id: "default" } } // add this
);
That single change routes requests through AI Gateway, unlocks unified billing, and adds per-request logging for latency, token usage, and errors. Your wrangler.toml stays the same — no binding changes required.
Setting Up Unified Billing
The unified billing wallet covers Workers AI alongside OpenAI, Anthropic, Google AI Studio, Google Vertex AI, xAI, and Groq — all drawn from the same prepaid balance. To enable it:
- Go to the AI Gateway dashboard and top up credits under Credits Available.
- In your gateway settings, set Workers AI billing to Unified billing.
- Optionally configure auto top-up with a minimum balance threshold to avoid production interruptions.
One honest caveat: Cloudflare applies a 5% fee on credit purchases. A $1,000 top-up costs $1,050. Per-token inference pricing passes through at provider list rates with no additional markup — so you pay the same as going direct to OpenAI or Anthropic, plus that 5% upfront fee. For teams already using AI Gateway’s spend controls and observability, this is a reasonable trade. For teams that only want cheaper inference, the overhead adds up.
You can also set spend limits per model, per provider, or per custom dimension — user ID, team name, application — via the unified billing documentation.
Model-First Routing Is the Interesting Part
The current release is useful but incremental. The genuinely compelling piece is model-first routing, currently in internal pilot. Instead of specifying a provider and model separately, you specify only a model name. The control plane selects the provider, handles failover, and load-balances across every host running that model — including Workers AI and external providers simultaneously.
When this ships publicly, it puts Cloudflare’s AI control plane in direct competition with tools like LiteLLM and OpenRouter — but with the edge-network advantage that inference stays on the same network as your Workers, Durable Objects, and storage. No extra round-trip to an external routing layer.
Should You Opt In?
If you are already on Workers AI and want observability without running a separate logging stack, opting in costs you one line of code. If you are already using AI Gateway for external providers, you can now call Workers AI models through the same gateway without additional setup.
The argument against: routing everything through Cloudflare’s control plane is a meaningful dependency. If you maintain direct provider relationships for contractual or compliance reasons, the unified wallet adds an intermediary. The 5% credit fee also cuts into margins for high-volume workloads where every basis point matters.
For Workers-native teams, this is a straightforward upgrade. For multi-cloud setups, evaluate whether the observability and routing features justify the dependency before committing.
What to Do Now
- Add the gateway parameter to your
env.AI.run()calls:{ gateway: { id: "default" } }. The Workers AI + AI Gateway integration guide covers the full setup. - Enable unified billing in the AI Gateway dashboard if you want one credit balance across all providers.
- Watch the changelog for model-first routing — when it ships, the calculus for switching changes significantly. The official announcement has background on where this is headed.













