# What is an LLM gateway?

> An LLM gateway sits between your app and many model providers. This guide explains what it does, how a request travels through it, when you need one, and when you do not.

- Date: December 4, 2026
- Category: guides
- HTML: https://anyrouter.dev/blog/what-is-an-llm-gateway

## 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.



The retry rules are in the [model fallbacks guide](https://anyrouter.dev/docs/guides/model-fallbacks). The log is described in [request logs](https://anyrouter.dev/docs/features/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](/blog/direct-provider-vs-gateway) walks through the trade-off, and [LLM gateway latency and failover](/blog/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](https://anyrouter.dev/llm-gateway) sums it up.

OpenAI Chat Completions, Responses, Embeddings and Anthropic Messages sit behind one base URL. Here is a request from the [quickstart](https://anyrouter.dev/docs/getting-started/quickstart).

```bash
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!"}]
  }'
```

_One call to the gateway. anyrouter/free picks a free model for you._

- Model ids are written provider/model, for example moonshotai/kimi-k3.1-pro. Browse them on the [models page](https://anyrouter.dev/models).
- Free models cost $0 per token on Go and up, with no daily cap and no credit deduction. See [free models](https://anyrouter.dev/free).
- Your own provider keys route at a $0 markup. See [bring your own key](https://anyrouter.dev/byok).
- Inference keys start with sk-ar-v1-. Management keys start with ak_.



## Where to go next

- [What is an AI router?](/blog/what-is-an-ai-router): the routing part of a gateway.
- [How to choose an LLM gateway](/blog/how-to-choose-an-llm-gateway): what to check before you pick one.
- [OpenAI-compatible LLM gateway](/blog/openai-compatible-llm-gateway): what compatible means in practice.
- [Free LLM router](/blog/free-llm-router): how free models are routed.
- [OpenRouter alternative](/blog/openrouter-alternative) and [AnyRouter vs OpenRouter](/blog/anyrouter-vs-openrouter): the comparison posts. The sourced table is at [anyrouter.dev/vs/openrouter](https://anyrouter.dev/vs/openrouter).

To make a first request, follow the [quickstart](https://anyrouter.dev/docs/getting-started/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.
