auto router

Get Auto Router Session

One auto-routed session, for the key that ran it: the model its last turn was routed to and the session's spend against the router's savings baseline. Built for a coding agent's status line or stop hook, so any virtual key may call it and only ever sees rows written under its own key hash. Reads the LiteLLM_AutoRouterSession rollup, which the asynchronous spend flush fills a moment after each turn; a session with no flushed auto-routed turn yet is a 404. The id is bounded the way the writer bounded it, so an oversized client id still finds its row.

get/auto_router/session

Query parameters

session_idstring required

The client session id (x-*-session-id header) the turns were sent under

The client session id (x-*-session-id header) the turns were sent under

Response

Successful Response

session_idstring required
router_namestring required

The auto-router alias the session's requests were sent to

router_typestring required

complexity, adaptive or quality

turnsinteger required

Auto-routed turns the rollup has recorded for this session so far

last_modelstring required

The deployment model the most recent turn was routed to

spendnumber required

What the session's routed traffic actually cost, classifier calls included

savings_estimated_turnsinteger required

Turns covered by the current savings estimator; legacy estimates are excluded

savings_estimated_actual_spendnumber required

Actual spend, including classifier cost, for covered turns only

saved_spendnumber nullable required

Estimated savings for covered turns only, net of classifier cost

baseline_spendnumber nullable required

Estimated single-model cost; unavailable unless every turn is covered

savings_estimated_baseline_spendnumber nullable required

Estimated single-model cost for covered turns only

baseline_modelstring nullable required

The savings baseline most covered turns were priced against, recorded turn by turn, so it still names the counterfactual after the router is reconfigured or removed. None when no turn recorded one: rows from before the baseline was recorded, and adaptive and quality routers, which derive no baseline and so report no savings

baseline_modelsobject required

Covered turns priced against each baseline model; more than one entry means the router's baseline changed mid-session and baseline_spend mixes both

Changes

Changed in 1 of the 51 revisions of this API.1