AI Research

What Is an AI Gateway?

What is an AI gateway? It is a single control point that sits between applications and the model providers behind them. Every request passes through it, so routing, budgets, guardrails, and logging happen in one place instead of inside each application.

Key Takeaways

  • A gateway gives every application one endpoint for many model providers.
  • Routing, authentication, budgets, caching, guardrails, and logging run in one layer.
  • A gateway differs from a classic API gateway: it understands tokens, prompts, and model behaviour.
  • LiteLLM, Kong, Portkey, and Cloudflare cover the main deployment styles, from self-hosted to edge.
  • A gateway pays off once several applications or teams share the same models.

The Short Answer: What Is an AI Gateway in Plain Terms

An AI gateway is a proxy and policy layer for model traffic. Applications call the gateway, and the gateway calls the model. Most vendor documents use the same term for text-model traffic, while AI model gateway is a third label for the same layer. The value is control: one place to decide which model answers, how much each call may cost, and what gets recorded.

How Does a Gateway Handle a Request?

Each request follows the same path through the gateway. A TrueFoundry guide to gateways describes the same request flow. The steps below show the order.

  1. Receive the request. An application sends one request format to the gateway endpoint.
  2. Authenticate the caller. The gateway checks a virtual key and maps it to a team, an application, or a budget.
  3. Apply policy. Rate limits, spending caps, and content guardrails run before any provider is called.
  4. Route the request. Rules pick a model by cost, quality, or availability, and a cache may answer repeated prompts directly.
  5. Call the provider. The gateway translates the request into the provider format and forwards it.
  6. Log the result. Tokens, cost, latency, and errors are recorded for every call.

What Functions Sit Inside a Gateway?

Six functions make up the core of a gateway. Newer gateways also govern tool calls through MCP, and what MCP is used for explains the protocol behind those calls.

  • Routing and failover: Rules send each request to the best model, and fallbacks switch providers when one fails.
  • Authentication and virtual keys: Real provider keys stay inside the gateway, while each application gets its own key with its own limits.
  • Budgets and rate limits: Spending caps and token limits apply per key, per team, or per model.
  • Semantic caching: Repeated or similar prompts return a stored answer instead of a fresh paid call.
  • Guardrails: Filters check prompts and responses for harmful content or sensitive data before delivery.
  • Logging and observability: Every call records tokens, cost, and latency for audit and debugging.

AI Gateway vs API Gateway: The Main Differences

The AI gateway vs API gateway distinction matters most at the model layer. A classic API gateway manages traffic to services that a team controls. A gateway for models points outward at third-party providers and understands tokens, prompts, and model behaviour. An Atlan explainer lists the same core capabilities.

AspectAPI gatewayAI gateway
Main jobManage traffic to services a team controlsGovern traffic to outside model providers
UnderstandsRequests, routes, and status codesTokens, prompts, models, and tool calls
Cost controlRate limits by request countBudgets by tokens, keys, and teams
CachingResponse caching by URLSemantic caching by prompt meaning
Typical useMicroservices and public APIsChat, agents, and model-powered features

The same comparison logic applies to protocols, and MCP vs API covers the protocol side.

Gateway vs Proxy vs Router: What Do the Terms Mean?

The vocabulary around gateways causes confusion, since vendors use the terms loosely. The table below separates the three roles.

TypeJobWhat it adds
ProxyForward requests to a providerOne endpoint and one request format
RouterChoose the model per requestRules by cost, quality, or availability
GatewayGovern all model trafficAuth, budgets, caching, guardrails, and logs

A proxy is the minimal version, and a gateway is the full version. LiteLLM Proxy shows the pattern: it starts as an OpenAI-compatible endpoint and adds virtual keys, budgets, and retry logic on top.

Which Gateway Products Exist?

LiteLLM

LiteLLM is an open-source proxy and Python SDK that calls 100+ models through one OpenAI-style interface. The proxy adds virtual keys, budgets, spend tracking, and retry logic. The project is MIT-licensed outside its enterprise directory.

Kong AI Gateway

Kong AI Gateway extends the Kong Gateway into model traffic, with routing, load balancing, access controls, and analytics across LLM, MCP, and agent-to-agent traffic. AI Proxy plugins translate OpenAI-format requests for each provider.

Portkey

Portkey offers a hosted gateway with an open-source core, plus routing, fallbacks, caching, guardrails, and observability. The open-source gateway runs on Docker, Node.js, or Cloudflare Workers.

Cloudflare AI Gateway

Cloudflare AI Gateway runs on the Cloudflare edge and adds caching, rate limiting, dynamic routing, fallbacks, spend controls, and observability to model calls. A Ramp guide to multi-model routing explains the routing logic that all four products share.

When Does a Gateway Pay Off?

A gateway pays off once several applications or teams share the same models. Shared budgets stop one team from draining the account, and shared logs show which feature drives cost. Audit needs add a further reason: regulated teams must record who called which model and what it cost. Agent fleets add another reason, since AI agent orchestration multiplies the number of model calls. A gateway does not pay off for a single application with one model and one developer. Direct calls stay simpler there, and the extra layer adds latency and maintenance without a clear gain.

Key Terms at a Glance

  • AI Gateway: A control layer that routes, governs, and logs traffic between applications and model providers.
  • LLM Gateway: Another name for an AI gateway, with the emphasis on text models.
  • Virtual Key: A gateway-issued key that maps an application to a budget and a rate limit without exposing provider keys.
  • Semantic Cache: A store of past answers that serves similar prompts without a fresh model call.
  • Guardrail: A filter that blocks or edits prompts and responses that break policy.

Conclusion

A gateway turns scattered model calls into one governed layer. Routing, budgets, guardrails, and logs sit in a single place, and a model change becomes a setting rather than a rewrite. The layer earns its keep once several applications share the same providers. For a single application with one model, direct calls remain simpler.

Frequently Asked Questions

Does a gateway run its own models?

A gateway does not run models. It routes requests to providers such as OpenAI, Anthropic, or Google, or to self-hosted inference servers.

How is a gateway different from a proxy?

A proxy forwards traffic. A gateway adds routing, budgets, guardrails, caching, and logging on top of forwarding.

What happens when a provider fails?

Fallback rules send the request to another provider or model, and retries cover short outages. The application sees one endpoint throughout.

Can a gateway cut model costs?

A gateway can cut costs through semantic caching, cheaper-model routing, and hard budget caps per key or team.

Is an AI model gateway the same as an LLM gateway?

The two labels describe the same layer in most vendor documents. The broader label sometimes signals coverage beyond text, such as embeddings or images.

Who manages the provider keys?

The gateway holds the real provider keys. Applications use virtual keys, so a leaked application key never exposes a provider account.

Related Reading on Future AI Wire

Sources