Back to the journal

AI infrastructure / 2 MIN READ

An AI gateway is a policy boundary

Routing a request is easy to draw. Deciding whether it should be routed takes more care.

Sai Sri Harsha Guddati ·

An AI gateway often appears in an architecture diagram as a small box between an application and a model provider. The box looks like plumbing. In practice, it is where a product's promises meet a platform's rules.

My work with LiteLLM includes provider routing, API-key authentication, role-based access, team isolation, budgets, and audit logs. These concerns belong together because access to a model is a decision about identity, resources, and responsibility.

Start with the decision

Imagine a research tool submitting a request for a model that its team has not been authorized to use. The gateway could know how to route the request and still need to refuse it. A correct destination is only one part of a correct decision.

I find it useful to separate four questions: who is asking, what they may use, which resources they may consume, and what evidence of the decision should remain. Each question should have an owner and an explicit failure behavior.

For example, an unavailable authorization dependency should not silently become unrestricted access. A budget check should not disappear because the route takes a fallback path. A new provider should not accidentally bypass team restrictions inherited from the original request.

Keep the policy legible

Complexity arrives when policy is scattered across clients, gateway configuration, and provider accounts. Two applications can appear to use the same service while enforcing different rules.

A central boundary can reduce that ambiguity, but centralization alone is not correctness. Configuration needs review, tests need to cover denials, and operators need to see why a decision happened. Successful requests are only half the test suite.

A practical review scenario is a key belonging to team A trying to access team B's resources. Another is a formerly authorized key after its permissions change. A third is a denied request during a provider outage. These cases expose accidental exceptions that happy-path demonstrations miss.

Treat refusal as a product behavior

A rejection should carry enough information for the caller to respond appropriately, without revealing another team's configuration. The user needs a useful next action; the operator needs a traceable reason.

A gateway becomes valuable when these decisions remain coherent as providers and applications change. The routing box stays small on the diagram. Its responsibilities deserve considerably more space in the design document.

More from the journal