[ Explainer ]

What is an AI gateway?

An AI gateway is a control point between your applications and the AI models and tools they call. This guide explains what it does, how a request flows through it, how it differs from an API gateway, and how the main options compare.

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

[ In short ]

An AI gateway is a service that sits between the software you build and the AI providers it depends on. Every request to a model, and increasingly every tool call an agent makes, passes through it. The gateway authenticates the caller, applies policy, picks a provider, handles failures, and records what happened.

It exists because AI traffic has properties ordinary API traffic does not: it is expensive per call, it goes to several competing providers at once, its inputs and outputs need inspecting, and the people sending it are often not engineers. A gateway turns those concerns into infrastructure instead of leaving them to every application team.

[ How it works ]

How a request flows through an AI gateway

The application never talks to a provider directly. It calls one endpoint with one credential, and the gateway does the rest in a few hundred microseconds to a few milliseconds, depending on the policies enabled.

Applications and agents

  • Product features
  • Internal copilots
  • Coding agents
  • Batch jobs

AI gateway

  • Authentication and keys
  • Budgets and rate limits
  • Routing and failover
  • Guardrails
  • Caching
  • Logs, traces, metrics

Models and tools

  • OpenAI, Anthropic, Google
  • AWS Bedrock, Azure, Vertex
  • Self-hosted models
  • MCP servers
  1. Step 01

    Authenticate and attribute

    The caller presents a gateway credential, usually a virtual key tied to a team, product or customer. The gateway resolves who is calling and what they are allowed to do.

  2. Step 02

    Apply policy

    Budgets, rate limits, allowed models and guardrails run before any provider is contacted. A request that breaks policy is refused here, at near-zero cost.

  3. Step 03

    Route

    The gateway chooses a provider and model from the ones allowed: by configured preference, by load, by cost, or by the health of each provider at that moment.

  4. Step 04

    Call and recover

    The request is translated into the provider’s API shape and sent. On a timeout, rate limit or outage the gateway retries or fails over to the next option without the application noticing.

  5. Step 05

    Record and return

    Tokens, cost, latency, the chosen provider and any guardrail outcome are written to logs, traces and metrics, and the response goes back in the shape the application expects.

Why AI gateways exist

The first generation of AI features was built by calling a provider SDK straight from application code. That works for one team and one model. It stops working when there are twenty teams, five providers, a finance department asking who spent what, and a security review asking what data left the building.

Each of those questions can be answered inside every application, with every team writing its own retry logic, its own key storage, its own usage counters and its own redaction. In practice they are not answered consistently, and the gaps show up as surprise bills, leaked keys and outages when a single provider has a bad day.

An AI gateway moves those cross-cutting concerns to one place. The pattern is the same one that produced API gateways for REST traffic and service meshes for east-west traffic: take the behaviour every caller needs, make it policy, and enforce it on the path rather than in the code.

What an AI gateway does

Products in this category vary, but the core responsibilities are stable. A gateway that lacks several of these is usually a router or a proxy rather than a gateway.

  • One interface for many providers. Applications call a single, usually OpenAI-compatible, API and the gateway translates to each provider’s own format. Switching models becomes a configuration change.
  • Credential management. Provider API keys live in the gateway. Callers get scoped virtual keys that can be rotated, limited and revoked without touching provider accounts.
  • Routing, load balancing and failover. Requests are spread across keys, regions and providers, and rerouted when one fails or slows down.
  • Budgets and rate limits. Spend and request volume are capped per key, team, customer or model, with the counters kept in one place so limits actually hold.
  • Guardrails. Inputs and outputs are checked for personal data, secrets, prompt injection and unsafe content, either with built-in checks or by calling an external guardrail service.
  • Caching. Identical or semantically similar requests can be answered from cache, which cuts cost and latency for repetitive workloads.
  • Observability. Every request produces a log entry, a trace span and metrics with the fields that matter for AI: tokens, cost, model, latency and outcome.
  • Tool and agent governance. Newer gateways also broker tool calls made through the Model Context Protocol, applying the same identity, policy and audit controls to what an agent can do, not just what it can ask. See What is an MCP gateway?.

Where it sits in the architecture

An AI gateway is deployed as a network service, typically inside the organisation’s own cloud account or cluster, and applications are pointed at it by changing a base URL and a key. Nothing about the application’s business logic changes, which is why migrations are usually measured in hours rather than weeks.

Downstream, the gateway holds the provider configuration: which accounts and regions exist, which models are approved, and which fallbacks apply. Upstream, it integrates with the identity provider for who is allowed in, with the observability stack for where telemetry goes, and with finance or platform tooling for budgets.

Because it is on the request path, latency matters. A gateway written for throughput adds overhead measured in microseconds; one that re-serialises JSON through several layers can add tens of milliseconds, which is noticeable on streaming responses. Any performance claim should come with a published method. Ours is at Performance benchmarks.

What an AI gateway is not

It is not a model. The gateway does no inference of its own; it decides where inference happens and under what rules.

It is not an API gateway with a new name. A general API gateway understands HTTP routes, authentication and rate limits, but it does not understand tokens, model names, provider failover semantics or the content of a prompt. Some API gateway vendors ship AI plugins that add parts of this; the comparison table below shows where the lines are.

It is not an observability platform or an evaluation tool. A gateway produces the telemetry those tools consume, and some ship dashboards, but judging whether an answer was good is a separate discipline. See What is AI observability?.

Deployment models and trade-offs

Gateways come in three shapes. Managed gateways run as a vendor-hosted service: nothing to operate, but every prompt and response transits the vendor, which rules them out for many regulated workloads. Self-hosted gateways run in your own VPC or cluster as a binary or container: full data control and the lowest latency, at the cost of operating one more service. Library gateways are code embedded in each application: zero infrastructure, but policy lives in every deployment and cannot be enforced centrally.

Open-source gateways let a team start self-hosted without a procurement cycle and inspect exactly what the data path does. Commercial tiers on top of them usually add single sign-on, fine-grained access control, clustering and support. Closed commercial gateways compete on breadth of integrations and on the vendor doing the operating.

How to evaluate an AI gateway

Start from the traffic you have. A team with one provider and a handful of apps needs routing and cost visibility; an enterprise with regulated data needs in-VPC deployment, identity integration and audit logs before it needs anything else.

  • Overhead under load, measured with a published method at a request rate close to yours, on streaming and non-streaming calls.
  • Provider coverage for the models you use today and the ones on your roadmap, including self-hosted models.
  • Governance depth: virtual keys, hierarchical budgets, rate limits, model allowlists, and whether they bind to your identity provider.
  • Guardrail model: built-in checks, pluggable external providers, or both; and whether they run on responses as well as requests.
  • Observability: native OpenTelemetry and Prometheus, log export to the stores you already run, and request-level cost attribution.
  • Deployment and data path: where it runs, what leaves your network, and how it is upgraded and clustered.
  • Agent readiness: MCP support, tool-call policy and audit, since agent traffic is the fastest-growing share of most estates.

[ Differences ]

AI gateway vs API gateway vs observability tool

Three categories are often confused because all of them sit near the request path. They answer different questions.

AspectAPI gatewayAI gatewayAI observability tool
Primary jobExpose and protect your own HTTP APIsGovern calls your software makes to AI providers and toolsUnderstand what AI calls did and how good the results were
UnderstandsRoutes, methods, headers, auth tokensModels, tokens, prompts, provider semantics, tool callsTraces, spans, prompts, outputs, evaluation scores
RoutingTo your backendsAcross providers, keys and regions, with failoverNone; it observes
Cost controlRequest quotasToken and dollar budgets per key, team or customerReporting after the fact
Content checksSchema validation at mostGuardrails on prompts and responsesOffline evaluation and scoring
Where it runsEdge of your platformBetween your apps and the providersBeside the app, fed by SDK or gateway telemetry
Typical ownerPlatform or API teamPlatform or AI infrastructure teamAI engineering or quality team

[ When you need one ]

When you need an AI gateway

A single application with a single provider can live without one. The moment any of the following is true, the gateway pays for itself quickly.

More than one provider or model

You want to switch, split or fall back between providers without redeploying applications.

More than one team

Several teams share provider accounts and someone has to attribute spend and enforce limits fairly.

Regulated or sensitive data

Prompts can contain personal or confidential data and you need redaction, audit logs and an in-VPC data path.

Availability targets

A provider outage or rate limit must not become your outage. Failover has to be automatic and tested.

Agents calling tools

Autonomous agents are reaching into databases, repositories and SaaS tools and you need to control which tools they can touch.

Cost pressure

The AI bill is material and you need caching, cheaper-model routing and per-feature cost visibility to bring it down.

[ The options ]

The main AI gateway options

The list covers products that call themselves AI gateways or LLM gateways and are in production use in 2026. It is ordered alphabetically, not by preference, and includes the gateway 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-gappedHigh-throughput LLM and MCP gateway with governance, guardrails and OpenTelemetry built inWritten in Go for low overhead; method and figures at Performance benchmarks.
Cloudflare AI GatewayManaged service, usage-basedCloudflare network onlyCaching, rate limiting, analytics and logging in front of provider APIsEasiest to adopt for teams already on Cloudflare; traffic transits Cloudflare.
Google ApigeeManaged serviceGoogle CloudEnterprise API management with AI-specific policies added onStrong for organisations that already govern APIs with Apigee.
Kong AI GatewayOpen source gateway with commercial plugins and enterprise tierSelf-hosted or Kong KonnectAI plugins on the Kong API gateway: routing, prompt policies, token meteringNatural choice where Kong already fronts the APIs.
LiteLLMOpen source (MIT) proxy, commercial enterprise featuresSelf-hosted Python proxy or vendor cloudBroad provider coverage behind an OpenAI-compatible API, virtual keys and spend trackingThe most widely known open-source option; Python runtime shapes its throughput profile.
PortkeyOpen source (MIT) gateway, commercial platformManaged cloud or self-hosted gatewayGateway plus prompt management, guardrails and observability in one platformManaged platform is the primary product; the gateway can run alone.
Solo.io Gloo AI GatewayCommercial, built on Envoy; agent gateway components open sourceKubernetesEnvoy-based AI and agent gateway for platform teamsFits organisations standardised on Envoy and Kubernetes networking.
TrueFoundry AI GatewayCommercialSelf-hosted in your cloud or managedGateway inside a broader ML platform, with an MCP gateway alongsideStrong when the rest of the ML platform is also TrueFoundry.
Tyk AI StudioCommercial, on the open-source Tyk gatewaySelf-hosted or Tyk cloudAI governance layer for the Tyk API management stackNatural choice where Tyk already fronts the APIs.

How this list was made

Options were taken from the products ranking for "AI gateway" and "LLM gateway" in October 2026 and from the alternatives customers most often ask us about. License, deployment and focus come from each vendor’s public documentation at the time of writing; where a vendor offers several tiers we describe the one the documentation leads with. We build Bifrost, so treat the row about it as a vendor’s description and test it against the same criteria as the rest.

FAQ

Frequently asked questions

Short answers about AI gateways.

Spotted a mistake? Tell us. Contact us

Mostly. "LLM gateway" is the older term and describes the same proxy for model traffic. "AI gateway" is used when the product also brokers tool calls, agents and non-text models. In practice the two labels are applied to the same products; the capabilities matter more than the name.

Yes, but how much depends entirely on the implementation. A gateway built for throughput adds overhead in the tens of microseconds; one that re-parses large JSON bodies through several layers can add tens of milliseconds. Ask for a published benchmark method and reproduce it at your own request rate.

Partly. An API gateway can authenticate callers, rate-limit by request count and route to a backend. It does not understand tokens, model names, provider-specific failover or prompt content, which is why API gateway vendors ship separate AI plugins or products for those parts.

For most teams the practical questions are where the data flows and who can read the code on the data path. Open source answers the second and self-hosting answers the first. A managed closed gateway can still be the right choice when the organisation already trusts that vendor with its traffic and does not want to operate anything.

Agents turn the gateway question from "which model can this app call" into "which tools can this agent use, as whom, with what audit trail". Gateways that implement the Model Context Protocol broker those tool calls with the same identity and policy they apply to model calls. The MCP gateway explainer covers it in detail.

Most migrations are a base URL and a key: point the existing OpenAI, Anthropic or framework SDK at the gateway and issue virtual keys to each team. Start with observability only, then add budgets and failover once the traffic is visible, then guardrails once you know what the prompts contain.