POST https://api.airouter.io/v1/select returns a ranked model-selection decision for applications that run their own gateway. It does not call a model, execute a completion, or return generated content. Your gateway uses the first candidate or applies its own policy to the ranked candidates, then sends the completion to the provider of its choice.
This endpoint is independent of the OpenAI-compatible chat completions path: calling one never calls the other.
Send an AI Router API key as a bearer token:
Authorization: Bearer $AIROUTER_API_KEY
Content-Type: application/json
The Decision API is available on paid plans. Requests that send an embedding additionally require the full privacy feature; see the pricing page.
Exactly one selection input is required:
messages sends the chat prompt to AI Router for embedding and selection.embedding keeps the prompt private. When it is used, embedding_type is also required and messages must be omitted.| Field | Type | Required | Description |
|---|---|---|---|
messages | array of objects | One input required | Chat messages used to make the decision. |
embedding | array of numbers | One input required | Client-generated prompt embedding. Requires embedding_type. |
embedding_type | "fastembed_mpnet" or "openai_small" | With embedding | Identifies the embedding model (paraphrase-multilingual-mpnet-base-v2 or text-embedding-3-small) so the matching benchmark data is used. |
model | string | No | Default model, as in chat completions. The Decision API never returns it; it must be a supported model name. |
models | array of strings | No | Candidate model names. Defaults to the team's enabled models (or the API key's subset). A model with reasoning efforts stands for all its efforts; <model>_<effort> (for example gpt-6-luna_low) for that effort only. ["router"] ranks all available models. A single entry is returned as the only candidate, without ranking. |
weighting | object | No | Non-negative costs, latency and quality boost factors; when sent, all three are required. Defaults to the team preferences. See Weighting. |
max_tokens | positive integer | No | Maximum completion tokens; the predicted answer length, and with it the predicted cost and latency, is capped at it. |
tools | boolean | No | Whether the completion will require tool support. Defaults to false. |
shadow | boolean | No | Records the decision as an observation instead of a routing decision. Defaults to false. See Shadow mode. |
Unknown request fields are rejected. messages and embedding cannot both be present, and embedding_type cannot be sent without embedding.
Generate the embedding in your environment with one of the supported embedding models, then send only its numeric vector:
The shortened vector is illustrative. Production input must contain the full vector produced by the embedding model identified by embedding_type. The response uses the same schema as the chat-prompt example and does not echo the embedding.
Privacy mode cannot use the prompt text, so it ranks with an earlier, embedding-based method that covers a fixed set of models from an earlier generation (such as gpt-5-mini and gemini-3.5-flash above). Other models in models are ignored; if none remains, candidates is empty. Contact us for the list.
| Field | Type | Description |
|---|---|---|
decision_id | string or null | Identifier used to report usage for this decision. It is null when the decision log was unavailable or no decision was made. |
candidates | array | Up to three candidates, best first, each a different model. |
candidates[].model | string | Canonical model name to use for the completion. |
candidates[].effort | "none", "minimal", "low", "medium", "high", "xhigh", "max", "reasoning", or null | Reasoning effort to pass to the provider. null when the model has no effort setting or the candidate names no effort. |
When AI Router makes no decision for the request, for example because none of the allowed models can be ranked, the response has this form:
When candidates is non-empty, choose candidates[0] for the router's preferred decision. The other candidates are the models the router itself would use next, for example when the first model's provider fails; each is a different model, at the effort the router would call it with. A single entry in models comes back as the only candidate. If candidates is empty, do not execute a model based on the response; handle the no-decision state according to your application's policy. Use decision_id as the handle when reporting the resulting completion's usage. When candidates are present, a null value means the decision log was unavailable; the selection remains valid, but its usage cannot be reported. When candidates are empty, decision_id is null because no decision was made, so there is no selection to use or report.
Send shadow: true to evaluate AI Router on live traffic before you let it choose models. The router ranks the candidates and records the decision exactly as for a normal request, and the response is identical, including decision_id. The difference is how the decision is recorded: it is an observation, and your application keeps executing the model it asked for instead of candidates[0].
Report the usage of the executed call against the shadow decision's decision_id as usual. Those reports are the baseline that the pilot report (GET /v1/pilot-report, available on the pilot plan) compares with the router's choices. The shadow mode of the LiteLLM plugin uses this field.
Shadow decisions are not routed tokens. Their usage is not billed as routed usage, is not estimated when no report arrives, and does not count as savings; see Usage and Billing.
| Status | Meaning |
|---|---|
400 | Invalid JSON or an invalid request (both or neither input, unknown fields, negative weights). |
401 | Missing or invalid API key. |
403 | The Decision API or full privacy mode is not included in your plan. |
404 | A name in model or models is not a supported model, or, in privacy mode, none of the candidates qualifies for the request. |
curl https://api.airouter.io/v1/select \
--request POST \
--header "Authorization: Bearer $AIROUTER_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"messages": [
{"role": "user", "content": "Explain quantum tunnelling."}
],
"models": ["gpt-6-luna_low", "claude-haiku-5-5_low"],
"weighting": {"costs": 1, "latency": 1, "quality": 1},
"max_tokens": 2048,
"tools": false
}'
{
"decision_id": "019c7f2e-2e30-7d10-b1e5-50aa75c49a36",
"candidates": [
{"model": "gpt-6-luna", "effort": "low"},
{"model": "claude-haiku-5-5", "effort": "low"}
]
}
curl https://api.airouter.io/v1/select \
--request POST \
--header "Authorization: Bearer $AIROUTER_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"embedding": [0.12, -0.34, 0.56],
"embedding_type": "openai_small",
"models": ["gpt-5-mini", "gemini-3.5-flash"],
"tools": true
}'
{
"decision_id": null,
"candidates": []
}
{
"messages": [
{"role": "user", "content": "Explain quantum tunnelling."}
],
"shadow": true
}