AI gateway
Definition
A proxy between apps and model providers that gives one API for many models and adds keys, logging, budgets, caching and fallbacks.
In more detail
Instead of every service holding provider keys and its own retry logic, requests go through a gateway. It translates between provider APIs, issues internal keys per team or app, records cost and latency, enforces budgets and rate limits, caches responses and fails over to another model when one errors.
Open-source options include LiteLLM and Portkey's gateway; Helicone and OpenRouter offer hosted versions, and cloud platforms have their own. A gateway is also a natural place for guardrails and data rules, but it is a single point of failure and sees all prompts, so run it with the same care as any other production proxy.
Related terms
LLM observability
Collecting traces, costs, latency and quality signals from AI applications in production so you can debug and improve them.
Model routing
Choosing which model handles each request, often sending easy requests to a small, cheap model and hard ones to a larger model.
Rate limit
A provider's cap on requests or tokens per minute or per day; requests over the cap are rejected with an error until the window resets.
Semantic caching
Reusing a stored model response when a new request means the same as an earlier one, judged by embedding similarity rather than exact text.
Read more about AI gateway
- LiteLLM
Open-source SDK and AI gateway that calls 100+ providers through one OpenAI-style API.
- Portkey AI Gateway
Open-source gateway for routing model requests with retries, fallbacks and guardrails.
- LLM cost optimisation
Cutting LLM costs with caching, model routing, batching and budgets.