The problem: several providers, as many interfaces
In production you rarely use one model. A capable model for requests needing reasoning, another for long documents, a self-hosted open model for simple volume. Every provider has its own application programming interface (API), its own request and response formats, its own rate limits and its own price list (see product and API comparison).
The consequence in code is mechanical: a per-provider branch everywhere a model is called, separate adapters, and a change to propagate everywhere on every interface revision. Adding a provider becomes a project.
A gateway solves this by sitting in between: it stands between applications and providers, exposes one interface, and translates behind the scenes.
Interface unification is what gets advertised, but it is not what matters most. What matters is that all traffic now passes through one place. That single point is the only one where an organisation-wide policy can actually be enforced: caching, rate limits, spend caps, automatic fallback, exhaustive logging, bans on sending certain data to certain providers.
Without a gateway, each of those rules has to be reimplemented in every application, and one application forgetting it is enough for the rule to stop being a rule.
What a gateway does
Translate
One call function, one message format, whatever the destination. Changing model becomes changing a string.
from litellm import completion
# The same call, whatever provider sits behind
response = completion(
model="mistral-large", # or any other model identifier
messages=[{"role": "user", "content": "Explain transformers to me"}],
temperature=0.7
)
The format used as common denominator is almost always OpenAI's, not because it is better but because it arrived first and everyone aligned on it. A de facto standard, not a specification.

Route
When several destinations can serve the same request (several deployments of one model, or several models deemed equivalent) something must choose. Four rules cover almost every case:
| Rule | How it chooses | When it fits |
|---|---|---|
| Round robin | Each in turn, stateless | Identical, interchangeable destinations |
| Least busy | To whichever has fewest requests in flight | Uneven load across destinations |
| By latency | To the fastest recently observed | Response time is the priority |
| By cost | To the cheapest that can serve | Budget is the priority |
The last two assume the gateway measures continuously what it routes. A latency rule without fresh measurement is yesterday's latency rule.
Fall back
This is the function that most often justifies installing one. If a provider returns a rate-limit or server error, the request is automatically re-sent to another, with the application none the wiser.
The typical chain: first provider, error; second provider, success; if all fail, an error returned to the application with the details of each attempt.
This is the consequence no brochure mentions, and it is serious. Falling back to another provider changes which model answers. Four effects to anticipate:
- Behaviour changes. Tone and length differ, and an instruction tuned for one model is no longer tuned for the other.
- Format may change. A service expecting schema-conformant JSON may get something else from the backup model, if that model handles constrained output differently (see structured output).
- Measurements become unreadable. An unexplained quality regression is often explained by a silent fallback the day before. The trace must therefore record which model actually answered, not just which was requested (see observability).
- Compliance can break. If the backup provider sits outside the permitted region, an automatic fallback moves data out with no human having decided anything. A fallback rule must be checked against the data residency policy, not only against availability.
Govern
This is what interests an organisation most, and developers least.
The gateway holds the providers' real keys; applications hold only an internal key. You can then revoke a team's access without touching any contract, cap a spend, refuse certain destinations for certain data categories, and hold an exhaustive log, the only place where "exhaustive" is a defensible word, since nothing passes anywhere else.

What the choke point costs
No serious page on gateways can skip this section.
The gateway is a single point of failure. If it goes down, every application goes down, including those whose provider is working perfectly. You have concentrated risk instead of spreading it, which is the opposite of the stated goal. The architectural consequence: a production gateway runs in several instances, and you verify that losing one is not enough to stop the service.
It adds a network hop. The added time is one extra round trip: a few milliseconds if the gateway sits in the same data centre as the application, several tens if it does not. Against model generation time, which runs from hundreds of milliseconds to several seconds, this is usually negligible, but geographic distance decides it, not the software, and it is measured rather than assumed.
It sees everything. Prompts and responses pass through it and, depending on configuration, are stored there. It therefore carries the same obligations as observability traces: lawful basis, retention period, location. See data governance.
It delays. A new model released by a provider is unusable until the gateway supports it. The decoupling you gain on the application side is paid for with one more intermediary in the adoption chain.
The tools, in verifiable characteristics
The market moves fast and comparison tables rated "basic" or "advanced" cannot be checked. Here are structural facts only, to be rechecked before any decision:
| LiteLLM | Portkey | Helicone | |
|---|---|---|---|
| Open source | Yes | Yes, the gateway, MIT licence | Yes, Apache 2.0 licence |
| Self-hostable | Yes | Yes | Yes |
| Managed offering | Yes | Yes | Yes |
| Stated focus | Library and proxy unifying a very large model catalogue | Configurable routing and fallback, built-in guardrail catalogue | Gateway paired with an observability platform |
One useful correction, because the mistake is widespread: all three are self-hostable. The idea that a "premium" gateway must necessarily be a managed service is false, and it leads teams to rule out options on a criterion that does not exist.
Two other names circulate. OpenRouter aggregates many providers behind a single key, which is convenient for comparison and prototyping but adds a commercial intermediary between you and the provider. Routers marketed as "intelligent", claiming to pick the best quality-per-dollar model per request on their own, appear and vanish regularly: the promise requires predicting an answer's quality before obtaining it, which is precisely the hard problem described in cutting the bill.
What belongs in the gateway, and what does not
A single choke point attracts everything, and that is a trap. Some markers:
Belongs whatever must hold for every application: keys, budgets, rate limits, fallback, logging, destination restrictions.
Does not belong whatever depends on the business: application logic, prompt construction, response interpretation. A gateway that rewrites prompts becomes a dependency nobody understands, and the smallest change hits every service at once.
Borderline: caching and guardrails. Both are legitimate at the gateway, and both are dangerous there, because the correct threshold differs by service. A semantic cache shared across all uses will apply to a regulatory-advice service the threshold tuned for a frequently-asked-questions service, with the consequences described in cutting the bill. Those settings must remain configurable per service, even if they execute in one place.
The architecture, and the practices
The usual stack:
- The applications, services, agents, interfaces.
- The gateway, in several instances.
- The providers, remote interfaces and self-hosted models (see model serving).
- Observability, fed by the gateway.
- Alerts on cost, latency and error rate.
Six practices, three of which are rarely applied:
- Configure fallbacks, checking that the backup destination is permitted by the data policy.
- Centralise keys, so revocation is a gesture rather than a project.
- Version the configuration. Routes, fallbacks and budgets are code: they live in a repository and go through review. A spend cap changed in a web interface with no record is an incident in preparation.
- Exercise the fallback. A fallback that never fires is a fallback never tested. Deliberately cut a provider, outside peak hours, and check that the switch happens, and that the resulting answer is still acceptable.
- Record the model that answered, not just the one requested.
- Watch the fallback rate. It rises quietly, and it is the first sign that a provider is degrading or a quota is set too tight.
Why it matters
The module's anchor applies here too, and particularly sharply. A proxy that unifies interfaces, spreads load and switches to a backup on failure is a classical distributed-systems component, predating language models by decades. Describing it applied to model calls is not in itself a contribution.
What can rise above lies in what the gateway decides, and on what data: the mechanism that picks a destination from an estimate of the request's difficulty rather than a written rule; the one that learns from past fallbacks when to switch before the error rather than after; the one that arbitrates between competing requests under a shared budget constraint; the one that enforces a data-residency constraint from the request's content rather than from the caller's identity alone. The question to ask of such a description is always the same: is the routing rule written by a human, or computed by the system?
1. What does a gateway really buy you, beyond unifying interfaces?
2. A team switches on automatic fallback to a second provider. Which consequence is most easily overlooked?
3. What risk does a gateway introduce by its very nature?
4. Should a semantic cache shared by all services sit at the gateway?
5. A provider starts degrading slowly. Which indicator reveals it earliest?