
Workers AI runs supported models on Cloudflare’s infrastructure. AI Gateway sits between an application and a supported model provider so the team can see and control requests. The provider runs the model. It may be Workers AI or an external service. An app can use a provider directly, route requests through AI Gateway or combine Gateway with Workers AI.
Separate the app, the gateway and the runtime
- Cloudflare Workers runs application code. A Worker might receive a request, look up public product information and prepare the prompt.
- Workers AI runs a model. Cloudflare’s model catalog and documentation describe the workloads and ways to invoke it.
- AI Gateway manages the model request. Depending on the provider and configuration, it can record usage and apply controls such as rate limits, caching and routing.
- An external model provider can run the selected model when you send a request to one of its supported routes. Its own service terms and model behavior still matter.
Cloudflare documents these roles in its AI application overview, Workers AI documentation and AI Gateway documentation. Use the product docs to verify model availability and pricing when you build. A decision based on the roles stays useful as individual models and plans change.
Worked example: a public catalog assistant
Imagine a small retailer answering questions about public product sizes. A Worker reads the relevant catalog entry and sends the example to a supported Workers AI model. Before displaying the draft, the app checks whether the size appears in the source text and shows readers the product page. The Worker controls the interface and the check. Workers AI produces the draft answer.
Later, the retailer tries a model from an external provider. It can send calls through AI Gateway to compare request volume, latency and error rates across routes. It reruns the same catalog questions and keeps a separate log of incorrect answers. A route that improves latency can still perform worse on uncommon product sizes, so both results inform the choice.
Check what changes when you insert a gateway
Draw the request path and list which service can see prompts, responses and logs. Review retention and access at each service before you include private inputs. If the answer depends on which account is asking, design and test cache separation before caching that route. If requests can fall back to another model, check the second provider’s policies and test its output on the same examples before routing real traffic to it.
Keep retry and fallback rules bounded. If a call fails, the app should have a clear outcome for the user, such as showing verified catalog details or offering a human support route. Our AI agent architecture guide explains where application logic, tools and checks sit around a model.
Pick the first service based on the problem
Start with Workers AI if you need model hosting and its catalog fits the task. Consider AI Gateway if you already call a model and need shared visibility or controls. If your app calls only one provider and its own controls answer your needs, compare that direct route with the extra component before adding it. Follow new products and infrastructure developments in our Cloudflare coverage.
Popular news

Tencent releases Hy4 weights with new terms for large AI hosts

Claude computer use reaches Team and Enterprise in beta

Proposed Claude-assisted Riemann proof passes independent checks

ChatGPT Space reaches Plus with shared pages and slides

Cognition launches Devin Bots to manage multiple coding sessions

