Cloudflare AI Gateway
Cloudflare AI Gateway adds analytics, logging, caching, rate limiting and routing to AI applications that call model providers.
At a Glance
About Cloudflare AI Gateway
Cloudflare AI Gateway is a service from Cloudflare that sits between an application and its AI model providers. Cloudflare's documentation says it gives visibility and control over AI apps through analytics and logging, and lets teams manage scaling with caching, rate limiting, request retries and model fallback. The docs state that getting started takes one line of code.
What It Is
AI Gateway is a proxy and management layer for AI traffic. Applications are connected to a gateway, which then records requests, tokens, costs and errors and applies controls before or after calls reach providers such as Workers AI, OpenAI, Anthropic, Google Gemini and Replicate. It can be used through a REST API or Workers bindings.
Observability and Control
The docs describe analytics for request counts, tokens and cost, plus logging of requests and errors. Further observability pages cover costs, user insights, custom metadata, log classification (beta), Logpush and OpenTelemetry. On the control side, caching serves repeated requests from Cloudflare's cache instead of the provider, and rate limiting caps how many requests an application sends. Routing lets users choose models and fallbacks with model aliases or build conditional flows with dynamic routes, and spend limits are listed as a beta feature.
Security and Configuration
Beta features listed in the docs include Data Loss Prevention and Guardrails. Configuration options include BYOK key storage, custom costs, custom providers, authenticated gateways, custom domains and Cloudflare Access.
Integrations
The documentation lists provider-native guides for many model vendors, including Amazon Bedrock, Azure OpenAI, Groq, Mistral AI, Perplexity and xAI. It also covers the Vercel AI SDK and coding agents such as Claude Code, Cursor, GitHub Copilot CLI, OpenAI Codex, Gemini CLI and Visual Studio Code.
Community Discussions
Be the first to start a conversation about Cloudflare AI Gateway
Share your experience with Cloudflare AI Gateway, ask questions, or help others learn from your insights.
Pricing
Free
AI Gateway core features (dashboard analytics, caching, rate limiting) are offered for free on all plans with a Cloudflare account.
- Dashboard analytics
- Caching
- Rate limiting
- DLP scanning free on all plans (two predefined DLP profiles without Zero Trust subscription)
- Legacy Logs: 100,000 logs total across all gateways on Workers Free
Capabilities
Key Features
- Analytics for requests, tokens and cost
- Request and error logging
- Response caching
- Rate limiting
- Routing with model aliases, fallbacks and dynamic routes
- Request retries and model fallback
- Spend limits (beta)
- Data Loss Prevention (beta)
- Guardrails (beta)
- BYOK key storage (beta)
- Custom costs and custom providers
- Authenticated gateways and custom domains
- Logpush and OpenTelemetry export
- REST API and Workers bindings
- WebSockets API (beta)
