November 24, 2026 · 10 min read · Architecture · Production · Governance
AI Gateway: One Control Plane, Many Models
Applications should not each talk to a model in their own way. An AI gateway puts authentication, routing, rate limits, cache and logs in one place. That is a control plane for model access — not a licence for agents to act.
Yassine Aqejjaj · HEAD OF AI · Updated on November 24, 2026
An AI gateway is a control plane between your applications and the models they call: authentication, routing, rate limits, cache and logs in one place. It does not choose the task, and it is not a gateway that authorises agent actions. In production, its value is one policy for many models, not a new logo on the stack.
What is an AI gateway?
An AI gateway is a single door in front of the models you use. Applications and agents do not carry their own keys, their own retry logic and their own idea of which model is allowed. They call the gateway. The gateway authenticates the caller, routes the request, applies a rate limit, may serve a cache, and writes a log.
That is deliberately unromantic. It is the same idea as an API gateway, applied to model calls. The value appears when you have more than one application, more than one model, or a rule that must be the same everywhere: who may call, which model they may use, what may be sent, and how you will explain the bill at the end of the month.

How is a model gateway different from an agent-control gateway?
The two are often named the same and do different jobs. A model gateway sits in front of model providers: it decides how a completion or an embedding is obtained. An agent-control gateway sits in front of actions: it decides whether the agent may write a file, send a message or call a production API, and whether a person must approve.
I built TrustRail as an attempt at the second job, in a sandbox where nothing real can go wrong. A public demo is at trustrail-mu.vercel.app. I would not treat that demo as a production control plane, and I have no published figure I can attach to it. I wrote about the wider governance argument — policies, human approval and signed receipts — in my article on AI agent governance. This article stays with the first job: a control plane for model access.
Why does a loop need a gateway at all?
An agentic loop may call a model on every turn: to plan, to act, to reflect. Without a gateway, each of those calls is a private arrangement — a key in an environment variable, a hard-coded model name, no common log. When something goes wrong, you cannot see the sequence. When a model must be replaced, you rewrite the agent. When a budget is blown, you find out in a vendor invoice.
With a gateway, the loop still decides the next step. The gateway only makes the call observable, limited and easier to change. That is the division I want: the loop owns the work, as I argue in my article on agentic loops; the gateway owns how the model is reached.
What should the gateway actually do?
Five functions earn their place on the first day, and I would not wait for a later “platform phase” to add them.
- Authentication and identity: every call is attributable to an application, a user or an agent, not to a shared key that nobody owns.
- Routing: a name such as “cheap”, “strong” or “sovereign” is resolved to a model behind the gateway, so changing provider is a configuration change.
- Rate limits and budgets: a run, a team or an application cannot quietly exhaust a quota.
- Cache: identical or near-identical requests should not always pay the full price. I return to that in my article on inference economics.
- Logs and traces: enough to replay a call and to explain a bill, without storing secrets in the clear.
Which failure modes should you design for?
Most gateway failures I review are not missing features. They are keys that leaked, routes that nobody can explain, or logs that stop at the application door. The table is the review I would run before the first production call.
| Failure mode | What it looks like | Control I look for |
|---|---|---|
| Keys in every application | A leaked environment variable opens every model you use | Secrets only in the gateway; applications receive a scoped credential |
| Hard-coded model names | Changing provider means rewriting agents | Routing by purpose, with the real model name behind the gateway |
| No budget | One loop or one team consumes the monthly quota | Rate limits and cost caps per caller, with an alert on outliers |
| Invisible calls | You cannot say which model was used, or what was sent | A log and a trace for every call, kept long enough to replay |
| Confused with action control | The team thinks model routing is enough to let an agent write to production | A separate policy for actions, with approval where the blast radius is high |
What have I measured here?
I do not have a published measurement that isolates a model gateway — no reduction in cost or latency I can attribute to this layer alone. I will not invent one. What I can say is how I would use such a plane: as a single policy and a single trail for model access, next to, not instead of, the controls on what an agent may do.
The figures I stand behind on cost sit elsewhere, and they are not gateway figures. On the DILA platform, pipeline optimisation and reuse contributed to a 30% lower cost per AI request; that result is published on the case page and I will not relabel it as a gateway result. The useful test of a gateway is simpler: can you change a model, explain a bill, and cut off a caller, without opening every agent? If the answer is no, you do not have a control plane yet. You have a collection of private arrangements that will be expensive to unwind.
What should you keep out of the gateway?
The gateway is a poor place to hide business logic. If a routing rule starts to encode “when the user is a manager, write a different plan”, you have moved the loop into the network layer, where it is harder to test and easier to forget. Routing should stay coarse: purpose, residency, cost class — not the next step of the task.
It is also a poor place to store raw prompts and tool outputs forever. Logs need enough to replay a failure and to explain a bill. They do not need a second copy of every confidential paragraph. Retention, redaction and access to the logs are part of the design, not a later cleanup. I return to that trail in my article on observability.
How does routing meet data residency?
Once several models are behind one door, the temptation is to send every call to whichever model is cheapest or most capable today. That is fine for public, low-stakes text. It is not fine when the prompt may contain data that must stay in a given region or on a given class of models.
A gateway is a good place to make that rule boring: a ceiling on what may leave, a default route that respects residency, and a hard refusal rather than a soft fallback that “just this once” uses an external model. The rule must be written before the first exception. A gateway that can route anywhere will, sooner or later, do so.
In what order should you introduce a gateway?
You do not need a gateway for the first local experiment. You need one as soon as a second application, a second model or a real budget appears. This is the sequence I would follow.
- Move keys out of applications and into one place, with a scoped credential for each caller.
- Route by purpose, not by a hard-coded provider name, and turn tracing on for every call.
- Add rate limits and a cost cap before the first busy week, not after the invoice.
- Add cache only when traces show repeated work that is safe to reuse.
- Keep action control on a separate path: a model gateway does not approve a write.
FREQUENTLY ASKED QUESTIONS
What is an AI gateway?
A control plane between applications or agents and the models they call. It typically handles authentication, routing, rate limits, cache and logs, so those concerns are not reinvented in every app.
Is an AI gateway the same as an agent gateway such as TrustRail?
No. A model gateway decides how a model is reached. An agent-control gateway decides whether an action may be taken. TrustRail is my attempt at the second job, in a sandbox; a public demo is at trustrail-mu.vercel.app, and it is not a production control plane.
Do I need a gateway to run an agent?
Not for the first experiment. You need one as soon as several applications, several models or a real budget appear, or as soon as you must explain a call after the fact.
Should the gateway choose the next step of the agent?
No. The loop decides the next step. The gateway makes the model call attributable, limited and easier to change. Mixing the two hides both decisions.
Where do cost savings come from?
From routing, cache, and not paying for calls you can avoid — and from work elsewhere in the pipeline. I have not published a figure that isolates the gateway itself. A related published result is the 30% lower cost per AI request on the DILA platform, from pipeline optimisation and reuse, not from a gateway I can name.
RESULTS
1
control plane in front of model calls
5
functions I want on the first day: auth, routing, limits, cache, logs
2
jobs often confused: model access and agent-action control
THE CODE
KEEP READING
Figures come from validated client results and from my role at Devoteam. The projects on GitHub are public betas.