What is an AI gateway? What it does and when you need one
An AI gateway is a proxy between the people, applications and agents that use AI and the models and tools they call. Because every request passes through it, the gateway can check who is calling, apply policy to prompts, answers and tool calls, route to approved models, cap spend and log each decision as evidence.
An AI gateway does five jobs in the request path
Without a gateway, every application and agent talks to model providers and tools directly, and every team decides for itself how to handle keys, data and logging. A gateway moves those decisions to one place that every request has to pass. Theglossary entry for AI gateway gives the short definition. This guide covers what the gateway does, how it differs from an API gateway, and how to tell whether you need one.
Know who is calling
Each request carries a named identity: a person, an application or an agent with its own credentials. A shared API key pasted into ten services tells you nothing when something goes wrong. The gateway ties every call to an owner.
Route to approved models only
Applications call one endpoint, and the gateway decides which provider and model serves the request. That is where you enforce an approved-provider list, keep certain data classes on models in a given region, and switch models without changing application code.
Apply policy to content
The gateway reads the prompt and the answer. It can mask personal data before it leaves, block secrets, score prompts for injection attempts and check answers before they reach a person or system. These are the runtime guardrails most policies call for.
Control spend and volume
Token budgets, rate limits and quotas per system, team or person. OWASP's unbounded consumption entry recommends rate limiting, quotas and monitoring of consumption, all of which need a single point that sees every request.
Record every decision
Each request leaves a record: who, which model, which policy and version, what was allowed, redacted or blocked, and what it cost. This log is the evidence a governance team hands to auditors and the input a security team sends to its SIEM.
An AI gateway reads the content an API gateway passes through
What it inspects
An API gateway mostly reads the envelope: path, headers, token, request size. An AI gateway reads the contents, because the risk sits in the text of the prompt and the answer.
How cost is counted
API gateways count requests. Model providers bill by tokens, so the cost of one request depends on the length of the prompt and the answer. An AI gateway meters tokens and money per caller.
What a policy can say
API gateway rules cover authentication, quotas and routes. AI gateway rules also cover data classes, approved providers, injection scores and whether a person must approve an agent's action.
Which direction it checks
An API gateway mainly protects the service behind it from callers. An AI gateway also protects the company from the response: ungrounded answers, leaked data or instructions that an agent might act on.
Agents need the gateway for tool calls as well as model calls
A chatbot only calls a model. An agent calls a model, decides on an action, then calls a tool: a CRM, an ERP, a payment system, often through an MCP server. The tool call is where the consequences are, so the gateway's checks need to cover it. The Model Context Protocol's own security guidance warns against token passthrough, where a server accepts a client's token without checking it was issued for that server. The guidance lists the costs: security controls that depend on the token get bypassed, and the audit trail can no longer tell clients apart. A gateway in front of MCP servers gives each agent its own identity and scope, and logs every call. For the governance side, seeMCP governance and AI agent governance.
Check the agent's identity on every call
Each agent uses its own short-lived credentials, issued for the gateway, so every tool call is attributable to one agent and the person or team it acts for.
Check the tool against the agent's grants
The gateway holds an allow list per agent. A call to a tool outside the list is refused and recorded, which also limits what a prompt injection can reach.
Pause high-impact actions
Calls that move money, delete data or contact customers above a set limit wait for a named approver, with the business record attached.
Stop an agent from one place
Because the agent's credentials only work through the gateway, revoking them there stops new model and tool calls at once. See the AI agent kill switch guide.
Five signs you need an AI gateway
Several teams call model APIs
Each team with its own keys means its own rules, or none. Discovery scans often find services calling model providers directly, outside any shared control.
Agents can act
Once an agent can call tools, every tool call needs an identity check, a permission check and sometimes a human approval. A shared enforcement point is the practical place to do that.
Regulated data could reach a model
Customer records, health data, payment card numbers or source code in prompts need a rule about which models may receive them, and a way to prove the rule held.
Auditors will ask for evidence
If a regulator, customer or internal audit will ask how AI use is controlled, a written policy is not enough. You need decision logs that show the policy running.
Nobody knows the AI bill
When spend is spread across cloud accounts, provider invoices and expense claims, a gateway is the one place that can attribute cost to a system and an owner.
Four questions decide how well a gateway works in practice
Most gateways can route traffic and count tokens. The differences that matter for governance show up when something goes wrong, when traffic tries to go around the gateway, or when an auditor asks for proof. Ask these questions before you choose or build one. The AI guardrails guide covers which rules to run once it is in place.
What happens when a check fails?
If the content filter is down, does the request go through (fail open) or stop (fail closed)? The answer can differ per policy: stopping a payment agent is safer than stopping an internal search tool.
What can it not see?
Coding assistants on laptops, browser extensions and teams with their own API keys can all reach models without touching a server-side gateway. Pair the gateway with shadow AI discovery and endpoint enforcement.
Are policies versioned?
Every decision should record the policy version that made it. Without that, you cannot show which rule applied on the day of an incident.
Where do the logs go?
Decision logs should flow to your security monitoring and to your governance evidence, linked to the AI system and the control they prove.
How the Moring AI gateway enforces policy
Policy runs where the request runs
Moring AI enforcement runs as a gateway or an SDK in your applications. Policies apply at the gateway alongside the agent runtime, the deploy gate, developer laptops, managed browsers and the network, and each one blocks, redacts, sends for approval, alerts or runs in monitor-only mode.
Content, data and spend checks
Filters run on every request, including prompt injection and ungrounded answers. Each data type is masked, tokenised, blocked or allowed, and data classes decide which models may receive it. Monthly budgets per team and per person send an alert at 80% and stop requests at 100%.
Agent tool calls checked before they run
Every agent acts with its own identity and only its granted tools, and the gateway checks each tool call against those permissions. The gateway also carries the stop switch for live agents.
Decisions become evidence
Each decision is logged with the policy version that made it, can stream to your SIEM, and counts toward the controls it maps to across frameworks. See the Moring AI gateway.
Frequently asked questions
What is an AI gateway, and what does it actually do?
An AI gateway is a proxy that sits in the path between users, applications and agents and the AI models and tools they call. It authenticates each caller, routes requests to approved models, applies policies such as data redaction and prompt injection filtering, enforces spend and rate limits, and logs every decision. See the Moring AI glossary entry for a short definition.
AI gateway vs API gateway: what is the difference?
An API gateway manages access to APIs: authentication, routing, rate limits and quotas, mostly from request metadata. An AI gateway does that for model and tool traffic and also inspects the content: it reads prompts and answers to redact data, catch injection attempts and check outputs, meters cost in tokens, and can pause an agent's action for human approval. Some AI gateways are built on API gateway software with these features added.
Do I need an AI gateway?
You probably do if more than one team calls model APIs, if agents can take actions through tools, if regulated or confidential data could appear in prompts, or if you will need to show auditors how AI use is controlled. A single prototype with no sensitive data can wait. The gateway becomes more useful as the number of systems, teams and providers grows.
What is an MCP gateway?
An MCP gateway applies the same idea to Model Context Protocol traffic, the calls agents make to MCP servers that expose tools and data. It checks which agent is calling, whether that agent may use that tool, and logs each call. The MCP specification forbids token passthrough: an MCP server must not accept tokens that were not issued for it. A gateway helps enforce that pattern across many servers.
Can an AI gateway be bypassed?
Yes, if a team holds its own provider API key or a laptop tool calls a model directly. Close the gaps in three ways: issue model credentials only through the gateway and revoke direct keys, run discovery to find services and devices calling AI providers outside it, and extend enforcement to developer laptops and managed browsers for tools that never touch your servers.
Does an AI gateway slow down responses?
It adds a network hop and the time its checks take. Simple checks such as identity, routing and spend limits add little. Content checks that run a classifier on every prompt and answer add more. Measure latency in your own environment with your real policies switched on, and decide which checks must block in line and which can run as alerts after the response.
Sources
- Model Context Protocol, Security Best Practices: Token passthrough as an anti-pattern and the requirement that MCP servers must not accept tokens not issued for them; scope minimisation. modelcontextprotocol.io. Checked 25 November 2026.
- OWASP LLM10:2025 Unbounded Consumption: Rate limiting, user quotas and consumption monitoring. genai.owasp.org. Checked 25 November 2026.
- OWASP LLM06:2025 Excessive Agency: Least privilege, authorisation in downstream systems and human approval for agent actions. genai.owasp.org. Checked 25 November 2026.
- OWASP Top 10 for LLM Applications 2025: genai.owasp.org. Checked 25 November 2026.
Deciding where your AI policies should run?
See how the Moring AI gateway checks each model and tool call against policy and keeps the decision as evidence.
Talk to Moring AI