Explainer

What is an LLM gateway, and how is it different from an LLM proxy?

An LLM proxy forwards requests to a model provider. An LLM gateway also controls who sends them, where they go, what they cost and failover.

An LLM gateway is a service between your applications and the language models they call. An LLM proxy only forwards requests to a model provider, often adding one key or a format translation. A gateway does that and more: it checks who sent each request, applies limits and budgets, picks the best destination, fails over when a provider breaks and records the cost.

Updated 2 December 2026.

Proxy vs gateway at a glance

LLM proxyLLM gateway
Forwards requests to a providerYesYes
Hides the real provider keyUsuallyYes
Translates between API formatsSometimesUsually
Keys per person or appRarelyYes
Rate limits and token budgetsRarelyYes
Routes across several providers and serversNoYes
Automatic failoverNoYes
Cost tracking per user, model, providerNoYes

A reverse proxy in front of one Ollama server that checks a single shared key is a proxy. Put five GPU servers and three vendors behind it, give every employee a budget and a model list, and you need a gateway. The line is blurry, and many products called "proxies", such as the LiteLLM proxy, are gateways by this definition.

What happens to a request inside an LLM gateway

Step by step, for a typical chat completion:

  1. Authenticate. The gateway reads the API key and finds who it belongs to: a person, a team or an app.
  2. Authorise. It checks that this key may call the requested model.
  3. Check limits. Requests per minute for the key, tokens left in today's and this month's budget.
  4. Choose a destination. From the providers that serve this model, it picks one: by priority, by current load, by cost or by latency, depending on the gateway.
  5. Forward and stream. It sends the request in the provider's format and streams tokens back to the app as they arrive.
  6. Fail over if needed. If the provider errors, times out or is rate-limited, it retries on the next one.
  7. Record usage. Tokens in and out, the model, the provider and the cost, tied to the key. Whether it also stores the prompt depends on the gateway and its settings.

When a limit is hit, the app gets a clear error, such as HTTP 429 with a header that says when the limit resets, instead of an unexpected bill.

Why the OpenAI format matters

Most LLM gateways accept requests in the OpenAI API format, because so many SDKs and tools already speak it. That's what makes adoption cheap: an app using the OpenAI SDK switches to a gateway by changing the base URL and key. Model servers like vLLM and Ollama also expose OpenAI-compatible endpoints, so a gateway can put your own models and vendor models behind the same URL. More in an OpenAI-compatible API for your own models.

Build or buy?

A minimal proxy is an afternoon's work. A gateway that handles streaming, retries, per-user budgets, health checks across several servers, cost tables for many models and an admin interface is a product. Unless the gateway is your product, adopting one is usually faster:

  • Open source, self-hosted: LiteLLM, Bifrost, Portkey's gateway
  • Hosted: OpenRouter, Vercel AI Gateway, Cloudflare AI Gateway
  • Commercial, self-hosted or managed: AI Gateway by LayerX

See best LLM gateways and OpenRouter alternatives for comparisons, and what is an AI gateway for the broader category.

When a gateway is worth it

A gateway earns its place when more than one of these is true: several apps or teams call models, you use more than one provider, you run your own GPUs, you need cost per person, or you have rules about logging and data location.

If you run your own GPUs, check how a gateway treats them. Most gateways treat your servers as one more provider. AI Gateway by LayerX is built around them: it sends requests to your vLLM or Ollama servers first, with health checks, concurrency limits and prefix-cache affinity, and moves to vendors only when needed. Each person gets their own keys and token budgets, and prompts are never stored.

Questions

What is an LLM proxy?

A service that forwards requests from your apps to a language model provider, usually hiding the real key or translating the request format. It doesn't usually handle per-user limits, routing across providers or cost tracking.

Is an LLM gateway the same as an AI gateway?

Almost. Both terms describe a layer between apps and models. "AI gateway" is sometimes used to include other model types, agents and tools.

Does an LLM gateway add latency?

A little. Gateways written for speed add microseconds to a few milliseconds per request, which is small next to model response times. Test with your own traffic.

Can an LLM gateway route to self-hosted models?

Yes. Most gateways can send requests to vLLM or Ollama servers through their OpenAI-compatible endpoints, alongside hosted providers.

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?