An AI gateway is a single endpoint that sits between your applications and the AI models they call. Every model request passes through it, so it is the one place to issue keys, set budgets, apply guardrails and record usage. It is also called an LLM gateway or an LLM proxy.
When every team calls model APIs directly, there is no single place to see what is being sent, stop what should not be, or cap what is being spent. A gateway gives you that place.
Applications call one OpenAI-compatible URL and ask for a model by alias. Which provider and model sit behind the alias is your decision, and you can change it without touching application code.
Each application or team gets its own gateway key. The provider credentials stay in the gateway, so a leaked application key can be revoked without rotating anything upstream.
Set a spending limit and an expiry on every key, and a request rate on the edge. A runaway loop hits its own limit instead of your whole bill.
Prompts and responses are checked for prompt injection, unsafe content, malicious links and sensitive data in one place, so no application can forget to do it.
The gateway decides where a request goes, retries a failed call, and can fall back to another model or region when one is unavailable.
Every call is logged with the key, the model, the token counts and the result, which gives you usage and spend per application without reading provider invoices.
The application sends the same request it would send to a model provider, to a different address, with a gateway key in place of the provider key.
An API gateway manages HTTP traffic. An AI gateway understands model calls. Most production setups use both: a load balancer or API gateway at the edge, and the AI gateway behind it.
| API gateway | AI gateway | |
|---|---|---|
| What it understands | HTTP requests: paths, methods, headers | Model calls: the model, the messages, token counts and cost |
| What it limits | Requests per second | Spend and tokens per key, as well as request rate |
| What it inspects | Request shape, known web attack patterns | The content of prompts and responses |
| How it routes | By host and path to a backend service | By model alias to a provider, with retries and fallbacks |
| Credentials | Passes the caller's credentials through, or checks them | Swaps the caller's gateway key for the provider credential it holds |
The main decision is who runs the gateway, because whoever runs it sees every prompt and response. A hosted gateway is quicker to start. A self-hosted gateway keeps the traffic inside your own cloud.
| Hosted gateway | Self-hosted gateway | |
|---|---|---|
| Where prompts and responses go | Through the vendor's service, then to the model provider | They stay in your own cloud project until they reach the model |
| Who runs it | The vendor | You, on infrastructure you already manage |
| Time to first request | Minutes | About 15 minutes with a ready-made module, longer if you build it |
| Upgrades | Happen when the vendor ships them | Happen when you choose, on a version you have pinned |
| What you pay | A subscription or a fee per request, on top of model costs | Your cloud bill for the resources, on top of model costs |
| Best fit | Small teams that want no infrastructure and can send prompts to a third party | Teams with sensitive data, a cloud platform already in place, or a need to control change |
Whichever way you host it, these are the properties that decide whether a gateway makes your AI traffic safer or only adds a hop.
Agent Ping publishes free, open-source Terraform modules that deploy a self-hosted AI gateway into a cloud account you own. No Agent Ping account is needed, and nothing is sent to Agent Ping.
The open-source LiteLLM gateway on Cloud Run, with Model Armor guardrails and Vertex AI Model Garden models. Released as v0.1.0.
One guarded, OpenAI-compatible endpoint, a key and budget per application, a private database, and credentials kept out of Terraform state. An evaluation setup takes about 15 minutes to deploy.
A gateway can tell you which key made a call and what it cost. It cannot tell you which agent run or which customer the call belonged to, or whether the answer was any good.
The key, the model, the token counts, the latency and the result of each request, and whether a guardrail blocked it.
Each call tied to the agent run it was part of, with cost per agent, customer and feature, alerts when an agent goes quiet, and quality scoring. Add an SDK from the integrations to the application that calls the gateway.
The open-source AI gateway, what the free edition includes, and how to self-host it on Cloud Run.
Google Cloud's guardrail service for prompts and responses: what it checks and what it costs.
Screening every request with Model Armor, failing closed, and the gaps to close around it.