[ Explainer ]

What is an LLM gateway?

An LLM gateway is a proxy that gives your applications one API, one set of credentials and one place for policy across every large language model provider. This guide explains how it works, how it differs from an SDK or a router, and how the options compare.

By Bifrost team at Maxim AI · Published · Updated · 10 min read

[ In short ]

An LLM gateway is a server that accepts requests in one API format, forwards them to whichever large language model provider is configured, and applies routing, failover, budgets, guardrails, caching and logging on the way. Applications talk to the gateway instead of to OpenAI, Anthropic, Google or a self-hosted model directly.

The term predates "AI gateway" and is still the one most engineers search for. Today the products behind both names are largely the same; an LLM gateway that also brokers tool calls and non-text models is usually marketed as an AI gateway. See What is an AI gateway? for the wider category.

[ How it works ]

How an LLM request moves through a gateway

The gateway owns the provider relationship. The application supplies a prompt and a model name; everything between that and the provider’s response is the gateway’s job.

Your application

  • OpenAI or Anthropic SDK
  • LangChain, LlamaIndex
  • Coding agents and CLIs
  • Internal services

LLM gateway

  • Virtual keys
  • Model allowlists and budgets
  • Load balancing and fallbacks
  • Semantic cache
  • Guardrails
  • Request logs and traces

Model providers

  • OpenAI, Anthropic, Google
  • Bedrock, Azure OpenAI, Vertex
  • Mistral, Groq, Together
  • vLLM, Ollama, SGLang
  1. Step 01

    Accept the request

    The application sends a chat, completion, embedding or other request to the gateway using a familiar API shape, usually OpenAI’s, with a virtual key instead of a provider key.

  2. Step 02

    Resolve identity and limits

    The virtual key maps to a team, customer or feature. The gateway checks its budget, rate limit and the models it may use before doing anything expensive.

  3. Step 03

    Check the cache and guardrails

    If an identical or semantically close request was answered recently, the cached response is returned. Otherwise input guardrails inspect the prompt for data that must not leave.

  4. Step 04

    Pick a provider and translate

    A provider and model are chosen by preference, weight, cost or health. The request is rewritten into that provider’s native format, including streaming and tool-call fields.

  5. Step 05

    Handle failure, log, respond

    Timeouts and rate limits trigger retries or a fallback provider. Tokens, cost and latency are recorded, output guardrails run, and the response is returned in the original API shape.

The problem an LLM gateway solves

Every provider has its own API, its own authentication, its own rate limits, its own error codes and its own idea of how streaming and tool calls look. An application that wants to use two of them has to implement both; one that wants to fall back from one to the other has to implement the mapping between their failure modes. Multiply that by every application in a company and the duplicated effort is large, and the inconsistency is larger.

Provider keys are the second problem. Without a gateway, the key that bills the whole company sits in the environment of every service that calls a model. Rotating it is a coordinated deployment, scoping it to a team is impossible, and attributing a bill to a feature means parsing provider dashboards.

An LLM gateway solves both by owning the provider relationship. Applications get one API and a scoped credential; the gateway gets the keys, the translation layer and the policy.

What a gateway does with each request

The capabilities below are what separate a gateway from a thin proxy. Not every product has all of them, and the order in which a team needs them is usually the order listed.

  • Unified API. One request format for chat, completions, embeddings, images, audio and tool calls, with the gateway translating to each provider. Most gateways expose the OpenAI shape, and some also accept the Anthropic and Google shapes so existing SDKs keep working.
  • Virtual keys. Scoped credentials that stand in for provider keys and carry the identity of a team, customer or feature.
  • Routing and load balancing. Weighted or health-based distribution across keys, deployments, regions and providers.
  • Fallbacks. Ordered alternatives that take over on errors, timeouts and rate limits, including across providers with different model names.
  • Budgets and rate limits. Token, dollar and request ceilings per key, with hierarchy so a team limit contains its members’ limits.
  • Caching. Exact-match and semantic caching, which matter most for retrieval and classification workloads with repeated inputs.
  • Guardrails. Input and output checks for personal data, secrets, injections and policy violations, built in or delegated to a guardrail provider.
  • Telemetry. Logs with prompts and responses where policy allows, OpenTelemetry traces and Prometheus metrics with cost and token fields.

Gateway, SDK wrapper or hosted router?

Three things get called an LLM gateway and only one of them is. An SDK wrapper is a library that normalises provider APIs inside your process. It gives you the unified interface and nothing else: no shared budgets, no central keys, no policy a platform team can enforce. It is the right choice for a single service that wants provider independence and nothing more.

A hosted router is a third-party service that fronts many providers under one key and bills you for the tokens. It removes provider accounts entirely and is convenient for experiments and small products, at the price of every prompt transiting the router and of a dependency you cannot run yourself.

A gateway is a service you run, or a vendor runs for you in your cloud, that holds your own provider accounts and applies your policy. It is the only one of the three that gives a platform team control over the whole estate, and the only one that keeps the data path inside your network when that matters.

Performance: why overhead matters more than it looks

A gateway is on the path of every token. For a non-streaming request that takes a provider two seconds, ten milliseconds of gateway overhead is noise. For a streaming request, overhead shows up as time to first token, and for high-volume classification or embedding workloads at thousands of requests per second it becomes the bottleneck.

The variables are the runtime, how much of the request body the gateway parses, and how it handles streaming. Gateways written in compiled languages and designed to stream bytes through add overhead measured in microseconds; gateways that deserialise the full body in an interpreted runtime add milliseconds and need more replicas for the same load.

Vendor numbers are only useful with a method. Ours, including the hardware, request mix and comparison setup, is published at Performance benchmarks so it can be reproduced or disputed.

Deployment: where the gateway runs and what that implies

Self-hosting puts the gateway in your VPC or cluster as a container or single binary. Prompts never leave your network, latency to your services is minimal, and you control upgrades; you also operate it, including clustering and state for budgets and caches.

Managed gateways remove the operating burden and add a hop through the vendor. For many products that is fine; for health, finance and government workloads it is often a non-starter, which is why most vendors offer an in-VPC option.

The hybrid that works for most enterprises is an open-source gateway self-hosted on the data path, with a commercial tier for identity integration, access control, clustering and support. It keeps the data path inspectable and the operating model familiar.

How to choose an LLM gateway

Make the shortlist with the deployment model and the provider list, because those are hard constraints. Then test the rest.

  • Compatibility: do your existing SDKs and frameworks work by changing a base URL, including streaming and tool calls?
  • Overhead: measured with a published method at your request rate, on your hardware class.
  • Failover behaviour: what counts as a failure, how fast fallback happens, and whether model names map across providers.
  • Governance: virtual keys, hierarchical budgets, rate limits and model allowlists, tied to your identity provider.
  • Observability: OpenTelemetry and Prometheus out of the box, and export to your log store.
  • Operations: clustering, zero-downtime config changes, upgrade path and what state it keeps.
  • Roadmap fit: MCP and agent tooling, since the next workload will be agents rather than chat.

[ Differences ]

LLM gateway vs SDK wrapper vs hosted router

The three are often listed together. They differ in where they run, who controls policy, and where the data goes.

AspectSDK wrapperHosted routerLLM gateway
Runs whereInside each applicationVendor’s cloudYour network, or a vendor-run instance in your cloud
Provider accountsYours, keys in every appThe router’sYours, keys held centrally
Shared budgets and limitsNoPer router keyPer team, customer, feature and model
FailoverIf you code itWithin the router’s providersConfigured once, across all providers
Data pathApp to providerApp to router to providerApp to gateway to provider, inside your perimeter
Policy enforcementNone centralVendor-definedYours, enforced on every call
Best forA single service wanting provider independencePrototypes and small productsAny estate with more than one team or sensitive data

[ When you need one ]

When an LLM gateway is worth it

If one team owns one application against one provider, an SDK is enough. The following situations are where gateways get adopted.

Second provider

You want to compare, split or fall back between providers without changing application code.

Shared provider account

More than one team bills the same account and finance wants the invoice split by feature or customer.

Key sprawl

Provider keys are in too many places to rotate safely and nobody can say which service uses which.

Rate-limit incidents

A provider’s rate limit or outage has already caused a user-facing incident and you need automatic failover.

Sensitive prompts

Prompts carry personal, financial or proprietary data and you need redaction, audit and an in-network data path.

Cost pressure

Model spend is material and you want caching and cheaper-model routing applied consistently.

[ The options ]

The main LLM gateway options

Products that front multiple model providers behind one API and add policy. Alphabetical, including the one we build.

OptionLicense and modelDeploymentFocusNotes
BifrostThe one we buildOpen source (Apache-2.0) core, commercial enterprise tierSelf-hosted binary or container, in-VPC or air-gappedLow-overhead gateway for LLMs and MCP with governance, guardrails and OpenTelemetryGo runtime; drop-in for OpenAI, Anthropic and Google SDK shapes. Method at Performance benchmarks.
Cloudflare AI GatewayManaged serviceCloudflare networkCaching, rate limiting, analytics and logs in front of provider APIsMinimal setup for Cloudflare customers; traffic transits Cloudflare.
HeliconeOpen source core, managed cloudManaged proxy or self-hostedObservability-first proxy with logging, caching and rate limitsStrong request logging; gateway features are lighter than the dedicated gateways.
Kong AI GatewayOpen source gateway with commercial plugins and enterprise tierSelf-hosted or Kong KonnectAI plugins for the Kong API gatewayNatural fit where Kong already manages APIs.
LiteLLMOpen source (MIT) proxy, commercial enterprise featuresSelf-hosted Python proxy or vendor cloudWidest provider list behind an OpenAI-compatible API, with virtual keys and spend trackingThe best-known open-source gateway; see our migration guide for the differences we see in practice.
OpenRouterManaged router, pay per tokenOpenRouter’s cloudOne key and one bill for hundreds of modelsA hosted router rather than a gateway you run; convenient for prototypes and individual developers.
PortkeyOpen source (MIT) gateway, commercial platformManaged cloud or self-hosted gatewayGateway with prompt management, guardrails and observabilityThe platform is the primary product; the gateway can run alone.
TrueFoundry AI GatewayCommercialSelf-hosted in your cloud or managedGateway within a broader ML platformStrong when the ML platform is also TrueFoundry.

How this list was made

The list combines the products that rank for "LLM gateway" in October 2026 with the alternatives prospects ask us about. License, deployment and focus are taken from each vendor’s public documentation at the time of writing. We build Bifrost; its row is a vendor description and should be tested like the others.

FAQ

Frequently asked questions

Short answers about LLM gateways.

Spotted a mistake? Tell us. Contact us

It is a reverse proxy that understands the traffic. A plain proxy forwards bytes; a gateway reads the model name, counts tokens, enforces budgets, translates between provider formats and fails over on provider-specific errors. The proxy is the delivery mechanism, not the product.

Usually only the base URL and the API key. Gateways expose the OpenAI API shape, and several also accept the Anthropic and Google shapes, so existing SDKs and frameworks keep working. Streaming and tool calls should be tested, since those are where translation layers differ.

When a request to the primary provider fails with a timeout, a rate limit or a server error, the gateway retries the same request against the next configured option, which can be another key, another region or another provider with an equivalent model. The application sees one response and, if it looks, a header saying where it came from.

From tens of microseconds to tens of milliseconds depending on the implementation and the policies enabled. The number only means something with a published method; reproduce the vendor’s benchmark at your own request rate before deciding.

Three mechanisms do: caching repeated requests, routing cheaper models for tasks that do not need the best one, and budgets that stop runaway usage. The first two need request-level visibility, which the gateway also provides.

Model calls are only half of what an agent does; the other half is tool calls. Gateways that implement the Model Context Protocol broker those too. The MCP gateway explainer covers what that adds.