Agent infrastructure

API strategy

AI gateway vs API gateway: what each one actually does, and when you need both

AI gateway vs API gateway compared: what each layer governs, where they overlap, and the tools-layer gap neither one covers for enterprise agent projects.

7 minute read
Decorative imagery showcasing Pontil's brand

You're standing up an agent project. Traffic patterns look strange. Costs are unpredictable. Someone in the security review asks whether your existing API gateway handles it, or whether you need one of the new AI gateways everyone's shipping.

The honest answer: they solve different problems. An API gateway sits in front of your APIs and enforces the rules a human developer's app would break. An AI gateway sits between your agents and the foundation models they call, and enforces the rules an LLM will burn a budget through by lunchtime. Neither replaces the other. Most enterprise agent deployments end up running both — and still find a gap between them.

This piece compares the two categories fairly, shows where each one earns its keep, and names the layer neither one covers.

How an API gateway works

An API gateway is a reverse proxy for HTTP traffic. It sits between callers and the backend services that answer them. The category is decades old — Kong, Apigee, AWS API Gateway, and Azure API Management are the anchors most enterprises know.

The job is straightforward. Terminate TLS, authenticate the caller, check the request against a rate limit, route it to the right upstream, and log what happened. Bolted onto that: request and response transformation, schema validation against an OpenAPI contract, quota enforcement per API key, IP allow-lists, and WAF integration. The traffic it understands is REST, GraphQL, gRPC, and WebSockets. The unit of work it prices is the request.

API gateways assume the caller is a program written by a human developer, holding a fairly stable idea of which endpoint it wants to hit. Rate limits are usually per-second and per-minute. Payloads are bounded — a few kilobytes for most requests, occasionally megabytes for uploads. Retry behaviour is deterministic: the client library retries on a specific status code with backoff, and the gateway sees a modest, predictable multiplier of traffic. This shape has held for fifteen years.

How an AI gateway works

An AI gateway is a reverse proxy for calls to foundation model providers. It sits between your application code (or your agent runtime) and providers like OpenAI, Anthropic, Google, Cohere, and self-hosted inference endpoints. Portkey, Kong AI Gateway, LiteLLM, and Cloudflare AI Gateway are the ones you'll see in most evaluations.

The job looks similar on the surface — proxy, auth, log — but the pressures are different. AI gateways track tokens, not just requests. They cache prompt-response pairs to cut cost on repeated calls. They fall back from one provider to another when a model returns an error or a 429. They enforce PII redaction on outgoing prompts because the outgoing payload is the sensitive part, not the response. They implement semantic caching, which means matching similar prompts, not identical ones. And they meter cost per user, per feature, per tenant — because a single agent turn can burn a dollar's worth of tokens, and finance wants to know why.

The traffic they see is lopsided in a way REST traffic isn't. Prompts can be hundreds of kilobytes. Responses can stream for thirty seconds. A single agent task can trigger dozens of model calls in a loop. Rate limits from providers are typically enforced in tokens-per-minute alongside requests-per-minute, and hitting either mid-conversation is a common failure mode. The gateway's job is to make that survivable.

Comparison

API gateway
AI gateway

Traffic type

REST, GraphQL, gRPC, WebSockets

Foundation model API calls (OpenAI, Anthropic, etc.)

Unit of metering

Requests per second

Tokens per minute, cost per call

Primary caller

Human-written applications

Application code and agent runtimes

Rate limit shape

Requests/second/API key

Tokens/minute/user, cost/day/tenant

Caching model

Response caching by URL and headers

Semantic caching by prompt similarity

Failover

Health checks to upstream instances

Cross-provider fallback (OpenAI → Anthropic)

Sensitive payload direction

Response (data leaving your systems)

Request (prompts leaving to third-party models)

Typical latency budget

Milliseconds

Seconds to tens of seconds

Auth model

API keys, mTLS, OAuth for the API surface

API keys to model providers, user identity forwarded

When to choose an API gateway

An API gateway is the right layer when the traffic you're governing is HTTP requests to services you own or third-party APIs your applications call. Concretely:

  • You're publishing a public API and need per-customer rate limits, API key management, quotas, and a developer portal.
  • You're operating microservices and need north-south traffic control, TLS termination, and centralised WAF policy.
  • You need schema validation against an OpenAPI contract at the edge, so upstream services don't have to.
  • Your compliance model requires request logging, audit trails, and traffic inspection for every call into your platform.

If the question is "who's allowed to call this endpoint and how often," the answer is an API gateway. This doesn't change because agents exist. If your agent code is making REST calls to your product's API, those calls still flow through the API gateway — and should.

When to choose an AI gateway

An AI gateway is the right layer when you have application code or agents calling foundation model providers, and the operational problems you're hitting are model-shaped. Concretely:

  • Your model spend is unpredictable and finance wants attribution per feature, per team, or per tenant.
  • You need to fall back to a second provider when the first one is rate-limited, degraded, or returns a bad response.
  • You're worried about prompts leaking PII to third-party model providers and want redaction enforced centrally.
  • You want semantic caching to cut cost on repeated similar prompts, especially in customer-facing features.
  • You need consistent observability across multiple model providers — one dashboard, one trace format, one billing view.

The LLM gateway enterprise use case is really this: you have three teams, four models, two providers, and no single view of what's happening. An AI gateway consolidates that. It's a governance and observability layer for a traffic shape API gateways weren't designed to handle.

The layer neither one covers

API gateways govern traffic to APIs that already exist. AI gateways govern traffic to model providers. Between them sits the harder question, and the one most enterprise agent projects actually stall on: what does the agent call to do something?

If your agent needs to update a record in your CRM, resolve a support ticket, or run a report inside your own product, neither gateway helps. The API gateway is happy to route the call — if the call exists. The AI gateway is happy to reason about which call to make — if there's a tool definition to reason about. The gap is that the API contract for what your product actually does is usually a small fraction of what the UI can do. This is what we call the 2% problem: APIs were built for the integrations and use cases the product roadmap prioritised. Everything else lives in UI code that no agent can reach.

The API gateway assumes the endpoints exist. The AI gateway assumes the tools exist. Neither one generates them.

How Pontil fits

Pontil is a Tools-as-a-Service platform. We sit in the tools layer of the agent stack — between the AI gateway that governs model calls and the API gateway that governs API traffic. Where AI gateways make LLM calls observable and API gateways make service traffic governable, Pontil makes your product reachable by agents in the first place.

We scan your existing codebase, generate connectors from the API surface that already exists, run them as tools with per-user authentication, and maintain them as your product changes. The tool calls then flow through your API gateway as normal — same auth, same rate limits, same audit trail. The agent's reasoning about which tool to call flows through your AI gateway as normal. What we add is the layer that turns product capability into callable tools, without a two-year API rewrite. See how it works in a product walkthrough.

What we'd choose

If you're picking one: it depends on what's actually hurting. If your problem is unpredictable model spend, three providers, and no unified observability — start with an AI gateway. If your problem is public API governance, per-customer rate limits, and a developer portal — you already have an API gateway, keep it. Most mature agent deployments run both.

But if the problem you're actually stuck on is that your agents can't reach what your product does — no gateway on either side of the model call is going to fix that. That's a tools problem, and it lives one layer down from either gateway.

Evaluate what you have. Name what's hurting. Then pick the layer that maps to it.

Join our weekly newsletter

Stay up to date on the ever changing agentic landscape.

POSTS

Related content

API strategy

Platform integration

API gateway vs iPaaS: which one fits the problem you actually have

7 minute read

API strategy

Agent infrastructure

Your APIs expose 2% of what your product can do

4 minute read

Agent infrastructure

Platform integration

Orchestrator vs tools layer: where agent work actually happens

7 min read