Skip to content

Architecture and migrationComparison

Cloudflare AI Gateway alternatives: when to stay, when to add

For a team already on Cloudflare, AI Gateway is the obvious first gateway: free core features, spend limits, dynamic routes. Most teams should start there. This guide is about the point some reach later, and which alternative fits each reason.

By INFRO Editorial

Published

4 min read

A dark ground with a large lit glass gateway and smaller amber nodes branching from it, representing a starting gateway and the alternatives teams add later

In short

Cloudflare AI Gateway's core features — analytics, logging, caching, rate limiting and retries with model fallback — are free on a Cloudflare account, and its spend limits cover BYOK traffic for priced models. Teams look for alternatives when they need negotiated rates stored centrally rather than sent in a per-request cf-aig-custom-cost header, routing logic for requests other than OpenAI chat completions (dynamic routes accept that shape only), an organization model of projects, roles and audit, or cost checked against the provider's bill. Alternatives: Vercel AI Gateway, self-hosted LiteLLM or Kong, OpenRouter, and BYOK control planes such as INFRO.

Key takeaways

  • Start with Cloudflare AI Gateway if you are on Cloudflare: core features are free and its spend limits count BYOK traffic for priced models.
  • Negotiated rates travel in a per-request cf-aig-custom-cost header, so every caller carries a copy of your commercial terms.
  • Dynamic routes accept the OpenAI chat completions shape only; other formats return 400.
  • Cloudflare describes cost tracking as a best-effort estimate and notes concurrent bursts can briefly pass a limit.
  • Teams add an alternative for central rates, an organization model, routing beyond chat, or reconciliation with the provider's bill.

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-cost header 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 lookAlternatives to consider
You deploy on Vercel and use the AI SDKVercel AI Gateway
You must self-hostLiteLLM, Kong AI Gateway, Bifrost
You want one balance for every model, no provider accountsOpenRouter, Vercel AI Gateway
Central negotiated rates, an organization model, reconciliationA BYOK control plane such as INFRO
Routing for media and Anthropic-shaped clientsKong 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.

Questions readers ask

Is Cloudflare AI Gateway free?
Its core features are free with a Cloudflare account: dashboard analytics, caching and rate limiting. Guardrails are billed as Workers AI inference, Logpush is billed by volume, and Unified Billing carries a 5% fee. Log storage has limits by plan.
Does Cloudflare AI Gateway support spend limits on my own API keys?
Yes, for models with known pricing. Cloudflare's spend limits page says they apply to both Unified Billing requests and BYOK requests for models with known pricing, returning 429 at the cap or routing to a fallback model.
What are the limitations of Cloudflare AI Gateway?
From its documentation: dynamic routes accept only the OpenAI chat completions request shape; negotiated rates are sent per request in a cf-aig-custom-cost header; cost tracking is a best-effort estimate; and a burst of concurrent requests can briefly exceed a spend limit.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.AI Gateway overview (opens in a new tab) — Cloudflare. Accessed Oct 20, 2026.
  2. 2.AI Gateway pricing (opens in a new tab) — Cloudflare. Accessed Oct 20, 2026.
  3. 3.Spend limits (opens in a new tab) — Cloudflare. Accessed Oct 20, 2026.
  4. 4.Dynamic routing (opens in a new tab) — Cloudflare. Accessed Oct 20, 2026.
  5. 5.Custom costs (opens in a new tab) — Cloudflare. Accessed Oct 20, 2026.
  6. 6.Bring Your Own Key (BYOK) to AI Gateway (opens in a new tab) — Vercel. Accessed Oct 20, 2026.
  7. 7.LiteLLM AI Gateway (proxy server) (opens in a new tab) — LiteLLM. Accessed Oct 20, 2026.
  8. 8.Kong AI Gateway (opens in a new tab) — Kong. Accessed Oct 20, 2026.

About this article

Every statement about Cloudflare AI Gateway is taken from its own documentation, opened on 2026-10-20: the overview, pricing, spend limits, dynamic routing and custom costs pages. Alternatives are described from their documentation opened the same day. Written by the team that builds INFRO; the article recommends Cloudflare where it is the better choice.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.