What is an LLM gateway?
An LLM gateway is a proxy between your app and many model providers. You call one base URL with one API key. The gateway routes the request, retries it on another provider when the first one fails, and logs it in one place.
Your code talks to a single, familiar API. The gateway handles the providers behind it.
What does a gateway do for you?
A gateway takes on the jobs you would otherwise write into every app that calls a model.
| Job | What it means |
|---|---|
| One API | One base URL and one key for every model, in the formats your client already speaks. |
| Routing | The model id you send decides which upstream serves the call. |
| Failover | A 401, 429 or 5xx from one upstream retries on the next, so the caller sees the answer and not the error. |
| One log | Every call records its model, tokens, cost, latency and errors in one place. |
| Your own keys | Route through provider keys you already pay for, with no markup on top. |
Here is the path of one request.
One request through a gateway
One request to the gateway base URL, with a model id written provider/model.
The retry rules are in the model fallbacks guide. The log is described in request logs.
Do you need an LLM gateway?
It depends on how many models and providers you call, and what happens when one of them fails.
| Your situation | What fits |
|---|---|
| One model, one provider, no failover need | A direct call is enough. |
| More than one model or provider | A gateway gives you one key and one API for all of them. |
| You want a retry on another provider when one fails | A gateway does it for you. |
| You want one log and one bill | A gateway keeps them in one place. |
A gateway adds one hop. If you only ever call one model from one provider, that hop buys you little. Direct provider vs gateway walks through the trade-off, and LLM gateway latency and failover covers the cost of the extra hop.
How does AnyRouter fit?
AnyRouter is an OpenAI- and Anthropic-compatible LLM gateway. One API key reaches hundreds of models, with automatic failover, free models, bring-your-own-key at $0 markup, and a shared key Pool. The LLM gateway page sums it up.
OpenAI Chat Completions, Responses, Embeddings and Anthropic Messages sit behind one base URL. Here is a request from the quickstart.
export ANYROUTER_API_KEY="sk-ar-v1-your-key"
curl https://anyrouter.dev/api/v1/chat/completions \
-H "Authorization: Bearer $ANYROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anyrouter/free",
"messages": [{"role": "user", "content": "Hello!"}]
}'- Model ids are written provider/model, for example moonshotai/kimi-k3.1-pro. Browse them on the models page.
- Free models cost $0 per token on Go and up, with no daily cap and no credit deduction. See free models.
- Your own provider keys route at a $0 markup. See bring your own key.
- Inference keys start with sk-ar-v1-. Management keys start with ak_.
Where to go next
- What is an AI router?: the routing part of a gateway.
- How to choose an LLM gateway: what to check before you pick one.
- OpenAI-compatible LLM gateway: what compatible means in practice.
- Free LLM router: how free models are routed.
- OpenRouter alternative and AnyRouter vs OpenRouter: the comparison posts. The sourced table is at anyrouter.dev/vs/openrouter.
To make a first request, follow the quickstart.
Official site
The official AnyRouter domain is https://anyrouter.dev, shortened as https://anyr.dev. It is the only valid domain for the API, docs, models, pricing and terms.
Sites on other domains that use the AnyRouter name are clones and are not affiliated with AnyRouter. Check the domain before you send API keys, credentials or payments.
FAQ
What is an LLM gateway?
An LLM gateway sits between your app and many model providers. You send one request to one base URL with one API key, and the gateway routes it, retries it on another provider when the first fails, and records it in one log.
Is an AI gateway the same as an LLM gateway?
People use the two names for the same idea: one entry point in front of many models. An AI router is the part that picks which model or provider serves a request.
Do I need an LLM gateway?
You need one when you use more than one model or provider, want a retry on another provider when one fails, or want one log and one bill. If you call a single model from a single provider, a direct call is enough.
Can I use my own provider keys with a gateway?
On AnyRouter, yes. Bring-your-own-key routes through the keys you already pay for at a $0 markup, so the provider bills you exactly what it charges.
Related posts
- Calling providers directly vs. routing through one gatewayComparisonsJuly 12, 2026 · Call OpenAI, Anthropic, and every other provider directly and you manage a key, an SDK, and an audit trail per provider. Route the same calls through one gateway and you manage one of each, at the cost of an extra hop. Here's the honest trade-off on auth, SDKs, failover, billing, audit logs, and switching cost.
- What is AnyRouter? A plain-English guide to AI model routingGuidesAugust 5, 2026 · An AI model router lets you call many LLMs through one API. Here's what AnyRouter is, why it exists, and whether it's useful for your next project.
- How automatic failover works in an LLM gatewayEngineeringJuly 12, 2026 · A single provider call has a single point of failure: one rate limit, one outage, one bad deploy on their end, and your request fails. Here's the actual mechanism AnyRouter uses to route around that, circuit breakers, escalating cooldowns, and a fallback chain, and why the extra hop barely registers next to model generation time.