API Gateway and AI Gateway: Do You Need Both?
Janet Wagner · rss · 2026-10-21 source ↗ Reader 🖥️
Agent Governance (Internal)Agent SecurityAgent-to-Agent ProtocolsAI Cost Visibility & FinOpsGateway Control Plane (API / AI / MCP Gateways)GuardrailsMCP (Model Context Protocol)Model RoutingPlatform Engineering
API gateways govern inbound client-to-service traffic with request-based semantics while AI gateways govern outbound application-to-LLM traffic with token-based semantics, so most organizations building LLM-driven applications need both today, even though vendors are converging them into a single layer.
practical · expository — A short explainer from an API-industry publication (Nordic APIs) that defines two infrastructure components, contrasts them, and argues for an architectural action (run both). Mostly expository, with one practitioner anecdote as the only evidence for the recommendation.
Structure
| Part | Role |
|---|---|
| Framing: traffic to backend services and to LLMs (and agents to APIs) must be governed for cost, security and performance | context |
| Definitions of API gateway (reverse proxy, routing, rate limiting, auth, observability) and AI gateway (model routing, semantic caching, token rate limiting, guardrails, LLM observability), with vendor lists | definitions |
| Key differences: inbound vs. outbound, plus a comparison table across purpose, caching, rate limiting, security, monitoring | evidence (conceptual contrast) |
| Why you would need both: API gateway if more than a few services, AI gateway if multiple LLMs; TrueFoundry/Kong anecdote of failing to run LLM traffic through the API gateway | conclusion with anecdotal evidence |
| Convergence: vendors are building platforms that house both capabilities, so the distinction may fade | qualification / forward-looking caveat |
Key terms
- API gateway
A reverse proxy specialised for APIs that governs primarily inbound traffic from clients to backend APIs/microservices (routing, request-count rate limiting, load balancing, authN/Z, protocol conversion, monitoring). - AI gateway Gateway Control Plane (API / AI / MCP Gateways)
Middleware and single control plane for outbound application-to-LLM interactions: prompts and responses, and for some products MCP tool calls and A2A traffic; capabilities include model routing, semantic caching, token rate limiting, prompt enrichment, input/output guardrails and LLM observability. - Semantic caching
Returning a stored response for similar (not identical) prompts, in contrast to API-gateway exact-match caching on URL and headers. - Token rate limiting
Throttling by LLM input and output token count rather than requests per second/minute, so a 50k-token prompt and a 200-token prompt are not counted as equal. - AI traffic
Prompts to LLMs and their responses, extended for some gateways to MCP tool-call requests and agent-to-agent (A2A) communication.
Propositions
- explicitAn API gateway is primarily about inbound traffic, acting as a reverse proxy between clients and backend APIs/microservices.conf: high
- explicitAn AI gateway is primarily about outbound traffic: it is the single control plane governing how applications call external or self-hosted LLMs (and, for some products, MCP tool calls and A2A traffic).conf: highsupportsAn Evolutionary Architecture Pattern for Managing AI's Pace of Change · p3 — Both place model routing, guardrails and policy in one gateway control plane for AI traffic.supportsThe Pulse: a new trend, smart model routing · p3 — Lists model routing as a core AI-gateway capability, consistent with routing being bundled into AI gateways.
- explicitAPI gateways and AI gateways are currently not interchangeable because they serve different types of traffic flowing in different directions.conf: high
- explicitRequest-count rate limiting is the wrong cost-control unit for LLM traffic: it treats a 50k-token prompt and a 200-token prompt as the same, whereas an AI gateway limits on input and output tokens.conf: high
- explicitThe two gateway types differ systematically beyond rate limiting: exact-match vs. semantic caching, schema/WAF security vs. prompt filtering, response validation and data-loss prevention, and API usage/latency monitoring vs. token usage, model cost and inference-time monitoring.conf: high
- explicitMost companies building LLM-driven applications should run both an API gateway (if they expose more than a few services) and an AI gateway (if they rely on multiple LLMs).conf: highrefinesAn Evolutionary Architecture Pattern for Managing AI's Pace of Change · p9 — Offers a concrete trigger (multiple LLMs, token-cost visibility) for when a dedicated AI gateway is warranted versus in-application guardrails.
- explicitRouting LLM traffic through an existing API gateway leaves teams blind to per-team token spend and unable to set budget caps that fire before the bill arrives; the failure is a category error (building an AI gateway inside an API gateway), not a defect of the API gateway.conf: highsupportsAn Evolutionary Architecture Pattern for Managing AI's Pace of Change · p2 — The Kong-for-LLM-traffic failure is a concrete instance of API gateways being insufficient on their own for AI traffic.
- explicitAPI and AI gateways are converging: vendors are building platforms housing both capabilities in a single layer for all traffic types, and the distinction may soon fade.conf: high
- implicitGovernance of LLM and agent traffic (cost, security, performance) is best done at an infrastructure chokepoint rather than inside each application's code.conf: medium
- implicitThe inbound/outbound split is blurred by the article's own scope: it lists agent-to-API traffic, MCP tool calls and A2A traffic under AI-gateway concerns, so the direction criterion is already unstable before the convergence section concedes it.conf: medium
- implicitThe evidence that the two gateways must be separate rests on one first-person account from an AI-gateway vendor (TrueFoundry), and the vendor lists show Kong, Gravitee, KrakenD and Tyk selling both categories, so the practical question is DIY-in-an-API-gateway versus a purpose-built AI capability, not necessarily two separate products.conf: medium
Arguments
Most organizations building LLM-driven applications need both an API gateway and an AI gateway. strength: medium
Explicit premises:
- API gateways handle inbound HTTP traffic with request-based rate limiting, exact caching and schema/WAF security.
- AI gateways handle outbound LLM traffic with token-based limits, semantic caching and prompt/response guardrails.
- The two operate on different traffic types and directions and are not currently interchangeable.
- A team that ran LLM traffic through Kong could not attribute token spend or cap budgets.
Implicit premises:
- Applications that call LLMs also still expose or consume ordinary APIs, so both traffic types coexist in one organization.
- Cost and safety controls for LLM calls must be centralized, not left to each application.
- A single anecdote from one team generalizes to 'most companies'.
- 'Both' means two separate deployed components, not one product with two policy sets.
Inferences:
- Budgeting and chargeback for AI should be implemented at the AI-gateway layer, since token-level data does not exist at the API gateway.
- Once platforms converge, the architectural decision becomes which policy sets to enable, not which gateway to deploy.
The API-gateway/AI-gateway distinction may soon disappear. strength: low
Explicit premises:
- More vendors are developing platforms that house the capabilities of both.
- Boundaries are steadily blurring.
Implicit premises:
- Vendor product bundling reflects what buyers will actually adopt.
- Token-aware and semantic features can be added to API gateways without the problems seen in the DIY case.
Inferences:
- The 'category error' in the Kaur anecdote becomes a product-maturity question rather than an architectural one when a vendor ships both in one box.
- The 'need both' advice has a shelf life that the article does not date.
Narratives
- TrueFoundry ran Kong for microservices and also pushed LLM traffic through it; they had no idea what each team spent on tokens, no budget cap that fired before the bill, and request-per-minute limits that treated 50k-token and 200-token prompts identically. They moved LLM traffic to the TrueFoundry AI Gateway and kept Kong for everything else.
→ Supports the claim that API gateways cannot substitute for AI gateways on LLM traffic and the 'need both' recommendation.
Questions addressed
- ✅ What is the difference between an API gateway and an AI gateway?
Direction (inbound vs. outbound), traffic semantics (requests vs. tokens/prompts) and the specific capabilities in the comparison table. - ✅ Do organizations need both?
Yes for most companies today: API gateway above a few services, AI gateway with multiple LLMs. - ⭕ Is the separation durable, or will the two gateway types merge into one product category?
Asserted that convergence is happening but deferred to a linked article; no timeline, evidence or implication for architecture. - ⭕ Which gateway governs agent-to-API and MCP tool-call traffic, which is neither classic client-inbound nor LLM-outbound?
Hinted at (some AI gateways cover MCP and A2A) but never addressed directly.
Gaps
- incompleteThe case for 'need both' rests on a single anecdote from an AI-gateway vendor (TrueFoundry), while the article's own vendor lists show Kong, Gravitee, KrakenD and Tyk selling both categories. It never tests the obvious counter-case: an API gateway with token-aware plugins (which these vendors ship) used for LLM traffic, so the anecdote only shows DIY-on-request-semantics failing, not that two separate components are required.
Read next: Independent practitioner comparisons or measurements of API gateways with AI plugins versus dedicated AI gateways, including budget-enforcement behavior and operational overhead, from sources without an AI-gateway product to sell. - incompleteThe decision rule is thin: 'more than a few services' and 'multiple LLMs' are given as triggers with no numbers, and the article never addresses the cost of running two gateways (latency, duplicated auth and policy, ownership) or says when a single-LLM team can skip the AI gateway.
Read next: Cost-benefit and maturity-staging frameworks for adopting a gateway layer, with concrete thresholds (teams, models, spend). - incompleteAgent-to-API and MCP/A2A traffic does not fit the inbound/outbound split on which the whole contrast is built. The article mentions it in the intro and in the AI gateway definition but never says which gateway should own tool-call authorization, rate limiting or audit when an agent calls an API.
Read next: MCP-gateway and agent-identity material on where tool-call authorization lives relative to API gateways (e.g. Morgan Stanley's API-layer governance argument, MCP gateway/registry patterns). - uninformedSecurity treatment is a feature checklist (input filtering, response validation, DLP). It does not consider the gateway as a newly concentrated attack target or single point of failure, nor how guardrail false positives/negatives change the calculus.
Read next: Threat-model discussions of centralized AI/MCP gateways and defense-in-depth guidance that says what a gateway should not be trusted to detect.
Closes gaps elsewhere
- An Evolutionary Architecture Pattern for Managing AI's Pace of Change · g5 — Partially: gives a concrete trigger (more than a few services; multiple LLMs) and a failure symptom (no per-team token spend, no pre-bill budget caps), though still without numeric thresholds.
Related documents
- AWS Releases Loom, an Open-Source Reference Platform for Governing AI Agents at Enterprise Scale
- An Evolutionary Architecture Pattern for Managing AI's Pace of Change
- Article: Securing MCP in Production: Defense-in-Depth Beyond the Gateway
- Why AI agents need a Context Lake
- Governing AI in the Cloud: A Practical Guide for Architects
- Presentation: APIs for Agents: Rethinking API Programs in the MCP Era
- Prompt Injection to Data Exfil in 3 Hops
- Article: Agentic Fitness Functions: Extending Evolutionary Architecture Beyond Deterministic Rules
- Your AI agent just blamed the network team. Now what?
- Presentation: Autonomous Data Products for the Autonomous Era: Rethinking Data Architecture for GenAI