POST /v1/recommend

POST /v1/recommend returns the production router's model choice for a prompt, the same decision model=auto makes, handed back instead of acted on. No LLM call.

POSThttps://api.getnadir.com/v1/recommend

Return the production router's model choice for a prompt. This is the same decision the proxy makes on model="auto", handed back to you instead of acted on. No LLM call.

Tip

This is the endpoint the Kong and APISIX plugins call. If you are building your own gateway integration, start here.

Authentication

Required. Send your key as X-API-Key. The candidate model set defaults to the models configured on that key.

Request body

promptstring

Raw prompt text to route. Supply this or messages.

messagesobject[]

OpenAI-style message list, used when prompt is omitted. Content-part arrays are flattened to their text parts.

modelsstring[]

Candidate models to choose among for this request. Defaults to the models configured on the API key.

cache_stateobject

Session prompt-cache state. When set, the decision becomes cache-aware: switching models forfeits the warm prefix, and the recommendation accounts for that.

Example

curl https://api.getnadir.com/v1/recommend \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $NADIR_API_KEY" \
  -d '{
    "prompt": "Summarize this changelog in two sentences.",
    "models": ["claude-haiku-4-5", "claude-sonnet-4-6", "claude-opus-4-6"]
  }'

Response

recommended_modelstringrequired

Model the router would dispatch to.

selection_methodstringrequired

Decision path that produced the choice.

tierstring

simple, medium, or complex, when the classifier ran.

complexity_scorenumber

Raw analyzer complexity score.

confidencenumber

Classifier confidence in the range 0 to 1.

cluster_idinteger

Prompt cluster, when cluster routing applied.

reasoningstring

Human-readable routing rationale.

candidatesstring[]

Models the router chose among.

cache_adviceobject

Cache-aware analysis. Present only when cache_state was supplied.

latency_msintegerrequired

Decision latency in milliseconds.

Info

Field names and types on this page are taken from the deployed schema at api.getnadir.com/openapi.json. The values in the example response are illustrative, not a recorded call.

Cache-aware routing

Switching models mid-session throws away the prompt cache you already paid to warm. If you pass cache_state, the recommendation prices that forfeit and returns a cache_advice object with decision, stay_cost_usd, switch_cost_usd, and switch_penalty_usd. The override only ever moves toward equal or better quality.

Info

Bucket or recommend? Use /v1/bucket when you want the tier and will map it to models yourself, or when you want a call that works with no key. Use /v1/recommend when you want one model name from the full production router.

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.