Cybersecurity

Managing AI traffic with Cloudflare AI Gateway

Cloudflare AI Gateway unifies model access and billing through Workers AI integration, offering rate limits of 50 requests per minute. The service provides centralized logging, caching, and security features to manage third-party model usage like OpenAI and Anthropic.

Managing AI traffic with Cloudflare AI Gateway

Cloudflare unifies model access and billing through its AI Gateway and Workers AI integration, which lets teams pay for third-party model usage like OpenAI or Anthropic via a single prepaid credit balance on one unified, monthly automated billing statement invoice. Users set the gateway’s Workers AI billing setting to Unified billing to use prepaid credits for Workers AI inference. Workers AI and AI Gateway provide a unified path to call models via the same AI binding or the REST API. The AI binding supports both Workers AI and third-party models through env.AI.run(). The REST API provides shared /ai/ endpoints. These endpoints use Cloudflare authentication across providers. This integration allows users to route a Workers AI request through AI Gateway by specifying a gateway ID. Requests routed through the gateway include logs and analytics for volume, errors, latency, token usage, and costs. Frontier Workers AI models provide a rate limit of 50 requests per minute per account, which exceeds the 20 requests per minute offered through standard billing. The gateway tracks cumulative spend from token usage and model pricing, then blocks requests once the cap is reached. Since you already know the basics, users can configure caching, rate limiting, request retries, and security. For developers needing data, the /crawl endpoint launched on March 10, 2026, provides an autonomous agent that uses a headless browser to discover pages via sitemaps and on-page links. The free plan for this service allows 5 jobs per day and 100 pages per crawl.

Cloudflare WAF operates at the edge before traffic reaches the origin. This reduces origin bandwidth and latency for blocked traffic. Cloudflare provides integrated Bot Management through behavioral signals, JS challenges, fingerprinting, and custom rules to mitigate abuse on its global edge network before malicious traffic reaches the origin server for your specific enterprise web application. Cloudflare uses a crowd sourced engine from all its clients to create rules automatically. In contrast, AWS WAF relies on users to identify potential threats and build rules manually. AWS WAF provides deep integration with AWS logging, CloudWatch, and Shield, but it requires manual rule configuration and explicit rule language. Cloudflare’s UI-first approach allows for faster rule iteration at the edge. Cloudflare often deploys new rules faster in response to global trends than AWS. If teams use Route53 for DNS, they cannot use Cloudflare because it requires control over the DNS. Users can use the AI Gateway to observe and control requests to AI providers through caching, rate limiting, logging, and routing. Cloudflare also offers spend limits in open beta to cap cumulative spend from token usage and model pricing. Can a managed edge proxy ever provide the same level of granular control as a regional AWS deployment?

Teams evaluate Cloudflare AI Gateway alternatives when they need self-hosted deployment, in-VPC isolation, air-gapped options, and on-premises infrastructure. Cloudflare AI Gateway runs as a hosted proxy on the Cloudflare edge network. Bifrost, an open-source gateway built in Go, provides a high-performance alternative for mission-critical AI workloads. Bifrost adds only 11 microseconds of overhead per request at 5,000 requests per second. This provides a significant performance advantage for engineering teams running high-concurrency AI workloads across over 1,000 different model providers and various global deployment environments. Bifrost uses Code Mode to let models write Python to orchestrate multiple tools, which reduces token usage by 92.8% and cuts execution time by 40%. Bifrost also provides virtual keys for hierarchical cost control. LiteLLM offers a lightweight Python proxy for prototyping, but it introduces more latency than Go-based options. It is a popular choice for Python-centric teams. Kong AI Gateway provides an option for platform teams already using the Kong API platform to extend existing policies to LLM traffic. OpenRouter provides a managed service for model discovery, but it lacks hierarchical budget controls and RBAC.

Feature Bifrost Cloudflare AI Gateway LiteLLM
Deployment Self-hosted Hosted Self-hosted
Latency 11us at 5k RPS Edge-dependent 100us-1ms+
Languages Go Managed Python

Cloudflare AI Gateway is the best choice for teams already using the Cloudflare edge.