Should you use Cloudflare AI Gateway or an alternative? If your traffic already runs through Cloudflare, start with AI Gateway: analytics, logging, caching, rate limiting and retries with model fallback are its core features1, and they are free with a Cloudflare account2. Its spend limits count your own-key traffic for models with known pricing3. Teams look elsewhere when they need negotiated rates held centrally, routing logic for requests other than OpenAI-shaped chat, an organization model of projects, roles and audit, or cost checked against the provider's bill.
This guide sets out where Cloudflare's own documentation draws those lines, and which alternative fits each reason.
What Cloudflare AI Gateway does well
- Free core. Analytics, caching and rate limiting at no charge; guardrails are billed as Workers AI inference and Unified Billing carries a 5% fee on purchases2.
- Spend limits in dollars. Budgets scoped by provider, model or a metadata key, applied to Unified Billing and BYOK requests for priced models, returning 429 at the cap or moving traffic to a fallback model through a dynamic route; up to 20 rules per gateway3.
- Visual routing with rollback. Dynamic routes compose conditions, percentage splits, rate and budget limits and model nodes, with drafts and "instant rollback"4.
- Your own rates. A
cf-aig-custom-costheader carries input, output, cache-read and cache-write rates per request, so estimates reflect negotiated pricing5.
For a single team on Cloudflare, that is a complete answer. Stay.
The lines teams reach later
Negotiated rates travel with every request
Custom costs are set per request in a header5. That works, and it means every service that calls a model must know your commercial terms, and a renegotiated rate is a deploy across all of them. Teams with several services and contracts often want rates stored once, per model and per provider account, and applied to every matching request. Negotiated rates vs list price explains why estimates drift when they are not.
Routing logic is chat-only
Cloudflare states that "dynamic routes accept the OpenAI chat completions request shape only", and that other formats, such as Anthropic Messages, return 4004. If your routing problem includes image, video or audio requests, or clients that speak Anthropic's API such as Claude Code, the visual routing does not cover them.
Estimates, not invoices
Cloudflare is straightforward that "cost tracking is a best-effort estimation based on token counts and model pricing", and that because enforcement trails real-time usage, a burst of concurrent requests can briefly exceed a limit3. Every gateway's per-request cost is an estimate; the question is whether anything checks it against the provider's own cost data, and whether limits hold under concurrent load. Reconciling LLM spend with provider invoices covers the first; the 500-request concurrency test the second.
One gateway, or an organization
AI Gateway's unit is the gateway, with access governed by Cloudflare account roles and identity carried in request metadata. Once several teams share AI spend, the questions become which team may call which model, who approved a budget change, and what each project spent — an object model of projects, keys, roles, allowlists and an audit log.
Alternatives by reason
| Reason to look | Alternatives to consider |
|---|---|
| You deploy on Vercel and use the AI SDK | Vercel AI Gateway |
| You must self-host | LiteLLM, Kong AI Gateway, Bifrost |
| You want one balance for every model, no provider accounts | OpenRouter, Vercel AI Gateway |
| Central negotiated rates, an organization model, reconciliation | A BYOK control plane such as INFRO |
| Routing for media and Anthropic-shaped clients | Kong AI Gateway, a BYOK control plane |
Vercel AI Gateway. Built into Vercel and the AI SDK. Note its BYOK behaviour: failed requests on your credentials are retried on Vercel's system credentials, and BYOK spend is not counted in budgets6.
LiteLLM. The default self-hosted gateway: more than 100 providers, virtual keys with budgets, spend tracking by key, team, user and tag, fallbacks and logging integrations, run against Postgres7.
Kong AI Gateway. For teams already on Kong: one API across major providers, failover, a semantic cache, model cost management with spend limits, guardrails and MCP tooling, with self-hosted or cloud data planes8.
INFRO. A hosted BYOK control plane on provider accounts you connect, with 0% markup on model spend. Negotiated rates are stored per model and optionally per provider kind from the Team plan and apply to every matching request; routes with priority or weighted targets apply to chat, image, video and audio requests, and INFRO also answers Anthropic's Messages and OpenAI's Responses APIs for coding agents; projects, environments, five roles, allowlists, budgets and an audit log are part of the organization model; and on the Business plan the month's estimate is compared with OpenAI's and Anthropic's own cost APIs. It costs a subscription where Cloudflare's core is free, and its response cache covers chat completions only.
Using both
Cloudflare and a control plane are not exclusive. A common pattern keeps Cloudflare at the edge for what it does best — caching, the network, Workers AI — and puts budgets, attribution and audit across every provider account in a control plane behind it. Decide which layer owns retries and spend limits so they are not applied twice.
Summary
Cloudflare AI Gateway is the right first gateway for teams on Cloudflare, and free. Add or move when you need rates held centrally rather than per request, routing beyond OpenAI-shaped chat, an organization model with audit, or estimates checked against the provider's bill — and pick the alternative by which of those you need.
