Skip to content
AnyRouter
All posts

What is an AI router?

An AI router picks which model or provider serves each request. This post explains how routing by model id works, what happens on a 401, 429 or 5xx, why your own keys go first, and how a router differs from a plain proxy.

What does an AI router decide?

An AI router sits between your app and many model providers. For every request, it decides which model or provider serves it.

You send one request to one base URL with one API key. The router does the picking, and your code stays the same.

How is a router different from a plain proxy?

A plain proxy forwards a request to one fixed destination. If that destination fails, the caller sees the failure.

A router chooses the destination for each request and can try another one when the first fails.

Plain proxyAI router
DestinationOne fixed upstreamChosen per request
Model selectionYou manage itBy the model id you send
On an upstream errorThe caller sees itRetries on the next upstream
Your own keysYou wire them inTried first when you have them

The longer comparison with calling a provider directly is in Direct provider vs gateway.

How does a request get routed?

  1. 1

    Send the request with a model id. Model ids are written provider/model, for example moonshotai/kimi-k3.1-pro. Send them to the base URL https://anyrouter.dev/api/v1.

  2. 2

    The router picks an upstream. It chooses an upstream for that model. Your own keys come first when you have them.

  3. 3

    A failure moves to the next upstream. On a 401, 429 or 5xx, the router retries the next upstream. Your client sees the final answer, not the error.

  4. 4

    The call lands in one log. Each request records model, tokens, cost, latency and errors. See request logs.

One request. The model id tells the router where to send it
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!"}]
  }'

Why do your own keys go first?

If you already pay a provider, you want those calls to use your account. The router tries your keys before any shared route.

Bring-your-own-key has a $0 markup. The provider bills you exactly what it charges.

You can still add failover on top. See model fallbacks for how to set it up.

What happens when a free model is busy?

Free routes share a throttled pool, so a busy hour can return 429.

Browse the free models or the full model list.

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.

FAQ

What does an AI router do?

An AI router picks which model or provider serves a request. AnyRouter routes by the model id you send, and falls back automatically on a 401, 429 or 5xx from one upstream.

Is AnyRouter an AI router?

Yes. AnyRouter is the product. AI router is the category it belongs to. It is an OpenAI- and Anthropic-compatible LLM gateway, so one API key reaches hundreds of models.

Will a router use my own provider keys?

Yes. When you have your own keys, the router tries them first. Bring-your-own-key has a $0 markup, so the provider bills you exactly what it charges.

What happens if a free model fails?

Free routes share a throttled pool, so a busy hour can return 429. If a :free model fails on every route, AnyRouter answers with anyrouter/free instead of an error and sets the response header x-anyrouter-fallback: anyrouter/free.

Related posts