Skip to main content
Docs
Alvin Routing

Alvin Routing

How Alvin automatically selects the right AI model for each request.

Alvin reads each prompt and sends it to the model best suited to it. You don't pick a model; you just ask for what you want.

How it works

Alvin evaluates each prompt against the current model catalog and sends it to the model best suited to it, then reports which model answered.

Selection accounts for what the request needs — the kind of task, how demanding it is, how much context it carries — and for cost, so that capable but expensive models are used where they're warranted rather than by default. The catalog changes as providers ship and retire models, and routing follows it.

Seeing the routing decision

Every response shows the model that answered it, alongside token count and latency. That attribution is deliberate: you should always be able to tell what actually ran.

You can also review routing patterns over time in Analytics, and see the cost breakdown by model in the cost dashboard.

Overriding Alvin

To use a specific model instead:

  1. Click the Model dropdown in chat settings
  2. Select the model you want
  3. Subsequent messages use it
  4. Click Use Alvin to hand routing back

Worth overriding when you need a particular model's capabilities, when you're comparing models directly, or when you're debugging. Otherwise routing generally does better than a fixed choice, because no single model is the right answer for every prompt.

Using Alvin from the API

Set the model to alvin:

curl -X POST https://api.elyxir.ai/v1/chat/completions \
  -H "Authorization: Bearer elyxir_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "alvin",
    "messages": [{"role": "user", "content": "Write a Python function to sort a list"}]
  }'

Routing metadata

Auto-routed responses carry the decision in both the headers and the body:

HeaderDescription
X-Alvin-ModelThe model that handled the request
X-Alvin-Task-TypeThe task class Alvin assigned to the prompt
X-Alvin-ConfidenceClassification confidence, 0.001.00

The body carries the same information in a routing field alongside the standard OpenAI response shape, so clients that can't read headers still get it.

Alvin Routing | Alvin