AI Gateway
A proxy in front of model APIs for routing, caching, and logging.
An AI gateway is a proxy in front of model APIs. It sits between your app and one or more providers so you can route traffic, cache repeated prompts, apply limits, and log usage in one place. Instead of teaching every service how to talk to every model, you teach them to talk to the gateway.
This pays off as soon as you have more than one model, more than one team, or a budget you actually have to watch. The gateway can fail over when a provider is down, send cheap tasks to a small model, and keep a record of what you spent. It is also a natural place to strip secrets from logs and to enforce a maximum token or dollar cap.
Keep the gateway thin. It should not own your prompts or your product logic. Its job is routing, policy, and observability. If you start hiding business rules inside it, every new feature becomes a gateway change.
A simple first version is enough: one endpoint, authentication, basic logging, and a cache for identical requests. Add routing and more providers after you can see the traffic you already have.