Skip to main content
Cloudflare AI Gateway exposes an OpenAI-compatible unified API, so you reach multiple vendors through a single endpoint by setting the model ID to a vendor/model route. The default vendor is Workers AI, which needs only a Cloudflare token and account ID. The Cloudflare class defaults to @cf/meta/llama-3.3-70b-instruct-fp8-fast. Agno rewrites any @cf/... ID to workers-ai/@cf/... for the gateway.

Authentication

Cloudflare needs an API token and your account ID. The AI Gateway ID is optional and falls back to default.

Example

Install the openai package, which Cloudflare uses as its client:
Use Cloudflare with your Agent:
View more examples here.

Parameters

Cloudflare extends the OpenAI-compatible interface and supports most parameters from the OpenAI model. For structured output on models without native support, set use_json_mode=True on the Agent.

Model selection

Pick the route by setting id:
Workers AI serves Google’s open-weight Gemma models, not the standard Gemini API. Invented IDs such as @cf/.../gemini-... return HTTP 400. For Gemini, use a google/... route with BYOK credentials. Vendor routes also need a model ID from the Cloudflare docs.