Skip to main content

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.

MethodPathSummary
GET/adaptive_router/stateRead 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:

StatusDescriptionBody
200One snapshot per adaptive router on the answering replica.application/json AdaptiveRouterStateResponse
401No valid key or Admin UI session was presentedapplication/json ProxyError
403Admin-only endpoint. Not allowed to access this.application/json ErrorDetail
404No adaptive_router is configured on this proxy.application/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
routersarray of AdaptiveRouterSnapshotYesOne snapshot per adaptive router deployment