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.
Table of Contents
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.
- Receive the request. An application sends one request format to the gateway endpoint.
- Authenticate the caller. The gateway checks a virtual key and maps it to a team, an application, or a budget.
- Apply policy. Rate limits, spending caps, and content guardrails run before any provider is called.
- Route the request. Rules pick a model by cost, quality, or availability, and a cache may answer repeated prompts directly.
- Call the provider. The gateway translates the request into the provider format and forwards it.
- 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.
| Aspect | API gateway | AI gateway |
|---|---|---|
| Main job | Manage traffic to services a team controls | Govern traffic to outside model providers |
| Understands | Requests, routes, and status codes | Tokens, prompts, models, and tool calls |
| Cost control | Rate limits by request count | Budgets by tokens, keys, and teams |
| Caching | Response caching by URL | Semantic caching by prompt meaning |
| Typical use | Microservices and public APIs | Chat, 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.
| Type | Job | What it adds |
|---|---|---|
| Proxy | Forward requests to a provider | One endpoint and one request format |
| Router | Choose the model per request | Rules by cost, quality, or availability |
| Gateway | Govern all model traffic | Auth, 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
Ethan Walker covers AI developer tools, software releases, and emerging technology trends for Future AI Wire. His reporting focuses on practical updates that help developers and tech teams stay current with fast-moving changes in the AI and software ecosystem.

