Head to head

Cloudflare AI Gateway vs LiteLLM: hosted edge or self-hosted proxy?

Cloudflare AI Gateway runs on Cloudflare's edge with free core features. LiteLLM is an open-source proxy you run yourself. Cost, privacy, controls compared.

Cloudflare AI Gateway is hosted on Cloudflare's network: you point your app at it and get analytics, logging, caching, rate limiting and fallbacks, with core features free. LiteLLM is an open-source proxy you run on your own servers, with 100+ providers and virtual keys, budgets and rate limits per key, user and team. Pick Cloudflare for zero operations and edge caching; pick LiteLLM when requests must stay in your network or you need per-person budgets.

Facts checked between 27 November and 3 December 2026.

At a glance

Cloudflare AI GatewayLiteLLM
Where it runsCloudflare's networkYour servers
SetupChange one URL in your appRun a proxy with Postgres, Redis at scale
CostCore features free; 5% on Unified Billing creditsFree open source; Enterprise quote-based; you pay hosting
ProvidersWorkers AI, OpenAI, Anthropic, Gemini, Replicate and more100+
CachingResponse caching at the edgeCaching
LimitsRate limiting per gatewayBudgets and rate limits per key, user and team
GuardrailsLlama Guard on Workers AI (billed as inference), free DLPFramework and Presidio free; some integrations need Enterprise
Prompt storageCan log requests; storage rules depend on account ageOff by default, opt-in

Sources: Cloudflare docs, Cloudflare pricing, LiteLLM docs.

Operations

This is the main trade-off. Cloudflare AI Gateway has nothing to run: you create a gateway in your Cloudflare account and change the base URL in your app. LiteLLM is software you deploy, patch and scale. LiteLLM recommends four workers on a 4 vCPU host, with Postgres for keys and spend and Redis once you run several instances.

LiteLLM also had two supply-chain incidents in 2026, so running it means pinning versions and verifying images (what happened).

Privacy and data path

With Cloudflare, requests pass through Cloudflare's network on the way to the provider, and the gateway can log them. With LiteLLM, requests go from your servers straight to the provider, and LiteLLM only stores request and response content if you turn on store_prompts_in_spend_logs. If your models run on your own GPUs, LiteLLM can keep that traffic entirely inside your network.

Controls over people and spend

Cloudflare's rate limiting controls how many requests reach a gateway, and its analytics show requests, tokens and cost. LiteLLM's free proxy gives each key, user or team its own budget and rate limits, with spend tracking and an admin UI. SSO beyond 5 users and audit logs need LiteLLM Enterprise (pricing).

Which one should you pick?

  • Pick Cloudflare AI Gateway if you want nothing to run, you're already on Cloudflare, or edge caching will save real money.
  • Pick LiteLLM if requests must stay in your network, you need budgets per person, or you need providers Cloudflare doesn't cover.
  • Compare more options in Cloudflare AI Gateway alternatives and LiteLLM alternatives.

For teams with their own GPUs

AI Gateway by LayerX runs on your servers, or LayerX hosts it, and sends requests to your own vLLM or Ollama servers first, moving to vendors when needed. People get their own keys, token budgets and model lists, and the gateway records usage without storing prompts. It has no caching or guardrails and supports OpenAI-compatible providers only. See AI Gateway vs Cloudflare AI Gateway.

Questions

Is Cloudflare AI Gateway free?

Core features, including analytics, caching and rate limiting, are free on all plans. Log storage, guardrail inference and Unified Billing credits (5% fee) can cost money.

Is LiteLLM free?

The open-source SDK and proxy are free. You pay for hosting. Enterprise features like SSO beyond 5 users and audit logs need a licence.

Can I use Cloudflare AI Gateway and LiteLLM together?

Yes, in principle: LiteLLM can call a provider through Cloudflare's gateway URL. Running two gateways in series is rarely worth the extra hop.

Which is better for data privacy?

LiteLLM, because it runs in your network and doesn't store prompts by default. With Cloudflare, requests pass through Cloudflare first.

More posts

Keep reading.

See how AI Gateway fits your setup.

Tell us what you run today and how many people need access. We'll get back to you to learn more about your setup.

See how AI Gateway fits your setup.

What do you run today?