AI Gateway

Automatic model routing

Let Roar pick the cheapest model that can handle each request.

Don't want to choose a model? Send "model": "auto" and Roar picks the lowest-cost model that can actually handle your request — automatically, per call.

Auto routing
curl https://cloud.roar-ai.com/v1/chat/completions \
  -H "Authorization: Bearer roar_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Summarize this email."}]
  }'

How it chooses

Your administrator curates a pool of models that are eligible for auto. For each request, Roar looks at what the request actually needs — streaming, tool calling, image input, JSON mode — and picks the cheapest eligible model that supports all of it. Because the pool is curated, "cheapest that fits" never means "worse than you'd accept": weak or experimental models simply aren't in the pool.

What you get back

The response names the model that actually ran (not auto), so you can always see what answered:

Response (excerpt)
{
  "model": "llama-3.3-70b",
  "choices": [{ "message": { "role": "assistant", "content": "…" } }]
}

Your usage records the request as auto and attributes cost to the model that ran — so you can see both how much traffic uses auto and exactly where the spend went.

The right kind of model for the task

Auto also looks at WHAT the request is: code (fenced code blocks) prefers models your administrator marked strong at code; mostly non-English text prefers multilingual-strong models. Preferences are soft — if no strength-matched model can serve the request, auto falls back to the cheapest capable one rather than failing.

Hard requests escalate automatically

Not every request should go to the cheapest model. When an auto request looks genuinely demanding — a very long input, or tool use (where small-model mistakes compound) — Roar routes it to the strongest tier in your auto pool instead, picking the cheapest model within that tier. The signals are measurable and predictable (input size, tool use), never content guessing, so the same request always routes the same way.

When to use it

  • High-volume, everyday tasks — drafting, summarizing, classification — where the cheapest capable model is plenty.
  • Cost control by default — teams that would rather not think about model choice at all, with hard tasks still landing on your strongest models.
Need a specific model for a task? Just name it directly — auto is opt-in and never overrides a model you choose. Tool calling, vision and JSON mode all work with auto: Roar only considers models that support what your request needs.