What is an AI gateway?
Without and with a gateway
Calling providers directly
- A key, an SDK and a bill per provider
- Fallback code written by you
- Spend spread across dashboards
- Rules enforced in your app
Through a gateway
- One key, one API, one bill
- Failover handled for you
- Every request costed in one place
- Budgets and rules per key

From a 1906 handbook on telephone exchanges.
The practical telephone handbook and guide to the telephonic exchange, 1906. Internet Archive Book Images, no known copyright restrictions, via Wikimedia Commons.
What a gateway usually does
- Unified API
- One request format for every model, usually OpenAI's Chat Completions.
- Routing
- Choosing the model, or the provider for a model, for each request.
- Failover
- Moving a request to another provider when one times out or errors.
- Cost and usage tracking
- Tokens, price and latency for every request.
- Governance
- Budgets, allowed models, guardrails, roles and audit logs.
Hosted or self-hosted
| Hosted (like DigitSpace) | Self-hosted proxy | |
|---|---|---|
| Set-up | Sign up and change a URL | Deploy and run a service |
| Provider keys | The gateway's credits, or your own | Your own |
| Upgrades and uptime | The gateway's job | Yours |
| Data path | Through the gateway's servers | Through yours |
When you need one
You probably don't need a gateway for one prototype on one model. You start to need one when you use more than one provider, when an outage would hurt, when several people or features share a bill, or when you have to prove where requests went.
Questions
Is an AI gateway the same as an API gateway?
It's a specialised one: on top of routing traffic it understands models, tokens, prices and provider health.
Does a gateway add latency?
A well-built one adds very little, since routing is decided in memory before the call. Most time is the model generating its answer.
Does it change model output?
No. The model's answer is passed back as it is; the gateway only changes which model or provider answers.
Read next
Live in a minute.
Create a key, change the base URL, send a request. No card needed with your own provider keys.
Start free