Adaptive router API
This page documents the 1 gateway endpoint tagged adaptive_router in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| GET | /adaptive_router/state | Read what the adaptive routers have learned |
Endpoints
GET /adaptive_router/state
Read what the adaptive routers have learned
Return the live posterior per request type and model, the score weights and the depth of the pending update queue for every adaptive router on this replica. Proxy admins and admin viewers may read it. The state holds counts only and never prompt or response text. The Adaptive Router tab of Router Settings shows the same numbers.
Example request:
curl -X GET "http://localhost:4000/adaptive_router/state" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One snapshot per adaptive router on the answering replica. | application/json AdaptiveRouterStateResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Admin-only endpoint. Not allowed to access this. | application/json ErrorDetail |
| 404 | No adaptive_router is configured on this proxy. | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
routers | array of AdaptiveRouterSnapshot | Yes | One snapshot per adaptive router deployment |