POST /v1/route

POST /v1/route picks a model, effort and prompt together from your menu, counting cache reads and writes, and keeps your current model when nothing clears.

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

Choose a model, effort, and prompt together. The default v2 decision compares original and compacted prompts on eligible models from your menu, including cache reads and writes. It keeps your current model when no supported alternative clears the quality and estimated cost checks.

Info

Costs are estimates over the supplied horizon. The decision API does not execute the model or cap an external provider bill. Confidence describes the task classifier, not the probability of successfully completing a task.

Request

Works keyless within the anonymous limits. Send X-API-Key for account policy and attribution. The current model must belong to the allowed menu; an organization policy conflict returns 409 and blocks dispatch.

promptstringrequired

The complete task, up to 500,000 characters. Model changes require full classifier coverage.

current_use_modelstringrequired

Your baseline. The alias requested_model is also accepted.

allowed_modelsstring[]required

Exact runnable model IDs, including the baseline. The alias menu is also accepted.

axesstring[]

Required coding, agentic, or math evidence. Missing or stale evidence cannot certify a candidate.

cacheobject

Supply model, total current_input_tokens, and measured cached_tokens. Zero means known cold. Omit cached_tokens when reuse is unknown: the baseline is priced fully cached and alternatives fully written. Without input/cache evidence, the original is retained. The default horizon is one turn; expected_output_tokens includes reasoning.

executionobject

Declare model_switch, prompt_rewrite, and effort support. Unsupported actions are excluded.

minimum_tierstring

Optional simple, medium, or complex floor. It can raise the classifier tier, never lower it.

costsobject

Declare decision_usd and retry_reserve_usd so fees and recovery allowance are included.

preserve_prefix_charsinteger

Keep this leading prefix byte-identical. V2 supports safe compaction only.

Example

Request (illustrative)
curl https://api.getnadir.com/v1/route \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Fix the spelling of recieve in README.md.",
    "current_use_model": "claude-opus-5-5",
    "allowed_models": ["claude-opus-5-5", "claude-haiku-4-5"],
    "axes": ["coding", "agentic"],
    "cache": {"model": "claude-opus-5-5", "cached_tokens": 0},
    "execution": {"model_switch": true, "prompt_rewrite": true, "effort": false}
  }'

Apply the response

Run suggested_model, suggested_effort, and suggested_prompt, also available as model, effort, and prompt. Null effort preserves the baseline setting on a keep and omits an override on a switch. Preserve unrelated dispatch parameters and verify the harness applied the choice.

The decision object contains action, required_tier, reason, baseline_cost_usd, selected_cost_usd, savings_usd, ceiling_met, candidate evidence, and assumptions. Changed recommendations must clear the default 5% savings floor. Declared decision fees can make a no-op exceed the baseline; that is reported, not hidden.

Use decision_version: route-v1 explicitly for the older contract. Unknown request fields return 422. Never substitute bucket.plan.model for the authoritative returned model.

Pages on this site

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