跳到主要内容
版本:最新版

Router management API

The router management API provides health, classification, configuration, storage, cache, compression, and replay operations. It listens on port 8080 by default and the local stack binds it to 127.0.0.1.

For model traffic, use the configured Envoy listener described in Router API.

Start with the live schema

The running router generates its endpoint discovery and OpenAPI document from the routes it has registered. Use these pages for exact request and response fields:

PathPurpose
GET /api/v1Endpoint discovery
GET /openapi.jsonOpenAPI 3.0 document
GET /docsInteractive Swagger UI

This page groups the API by user task. The live OpenAPI document is the field-level source of truth for the version you are running.

curl -sS http://localhost:8080/health
curl -sS http://localhost:8080/openapi.json

Access and authentication

The local CLI keeps the management port on loopback. For a remote router, prefer a private network or an SSH tunnel instead of publishing the port:

ssh -N -L 8080:127.0.0.1:8080 router-host

Management authentication is disabled unless configured. To require bearer tokens, set global.services.management_api.auth.mode: bearer and define roles and token sources in the management API configuration. Then send:

Authorization: Bearer <token>

GET /health remains public. Other routes enforce their assigned permission when bearer authentication is enabled. Configuration and replay responses can also redact sensitive fields unless the principal has the corresponding detail permission.

Health and discovery

MethodPathUse
GET/healthProcess liveness
GET/readyWhether startup has completed
GET/startup-statusStartup and model-download progress
GET/api/v1Registered endpoint discovery
GET/openapi.jsonGenerated OpenAPI schema
GET/docsSwagger UI

Use /health for liveness and /ready for readiness. During model download or runtime preparation, a process can be healthy while /ready still returns 503.

Inspect signals without an inference call

The classification endpoints are useful when tuning signals or diagnosing why a decision did not match. They do not call a generation backend.

curl -sS http://localhost:8080/api/v1/classify/intent \
-H 'Content-Type: application/json' \
-d '{"text":"Write a Python function that merges two sorted lists."}'
MethodPathUse
POST/api/v1/classify/intentEvaluate intent/domain routing
POST/api/v1/classify/piiDetect configured PII types
POST/api/v1/classify/securityEvaluate jailbreak and security classification
POST/api/v1/classify/fact-checkDecide whether text needs fact checking
POST/api/v1/classify/user-feedbackClassify user feedback
POST/api/v1/classify/combinedRun intent, PII, and security classification
POST/api/v1/classify/batchRun a selected classifier over a batch
POST/api/v1/evalEvaluate all configured signals
POST/api/v1/nliEvaluate a premise/hypothesis pair
POST/api/v1/embeddingsGenerate configured text or image embeddings
POST/api/v1/similarityCompare a text pair
POST/api/v1/similarity/batchRun batch similarity matching

Names, scores, and matched rules depend on the active recipe. Use the live schema for each endpoint's supported input forms.

Inspect models and metrics

MethodPathUse
GET/info/modelsLoaded model inventory
GET/info/classifierClassifier configuration and status
GET/api/v1/embeddings/modelsLoaded embedding models
GET/v1/modelsOpenAI-compatible model list
GET/metrics/classificationClassification counters and timing

Secrets in classifier information are redacted unless the caller has secret_view.

Read and change router configuration

Read the current canonical document and its ETag before making a change:

curl -i http://localhost:8080/config/router \
-H "Authorization: Bearer ${VSR_MGMT_TOKEN}"
MethodPathUse
GET/config/routerRead the active canonical configuration
POST/config/router/validateValidate and normalize without writing
PATCH/config/routerMerge, validate, persist, and hot-reload an update
PUT/config/routerReplace, validate, persist, and hot-reload the document
GET/config/router/versionsList configuration backups
POST/config/router/rollbackRestore a backup
GET/config/hashCompare persisted, generated, and active hashes

Recipe operations use the same canonical document:

MethodPathUse
GET/config/router/recipesList default and named recipes and their entrypoints
POST/config/router/recipes/validateValidate a recipe mutation without applying it
GET/config/router/recipes/{name}Read one recipe
PUT/config/router/recipes/{name}Create or replace one recipe
DELETE/config/router/recipes/{name}Delete an unreferenced named recipe

Recipe PUT and DELETE require If-Match. Config mutations validate before writing, create a backup, and trigger reload; a successful HTTP response does not mean upstream model backends themselves are healthy. Check /ready and send a representative request after a change.

Manage knowledge bases and stored data

Knowledge-base configuration:

MethodPathUse
GET, POST/config/kbsList or create managed knowledge bases
GET, PUT, DELETE/config/kbs/{name}Read, update, or delete one knowledge base
GET/config/kbs/{name}/map/metadataRead generated map metadata
GET/config/kbs/{name}/map/data.ndjsonStream map data as NDJSON

OpenAI-compatible storage and router memory:

ResourceBase pathOperations
Long-term memory/v1/memoryList and delete by scope; read or delete by id
Vector stores/v1/vector_storesCreate, list, read, update, delete, and search
Vector-store files/v1/vector_stores/{id}/filesAttach, list, inspect, and detach files
Files/v1/filesUpload, list, inspect, download, and delete

These routes return 503 when their required service is unavailable. File upload uses multipart form data; consult the live schema for limits and fields.

Operate the response cache

Response-cache endpoints are separate from inference-time cache lookup. They let operators inspect the backend, test a candidate configuration, and perform audited invalidation.

MethodPathUse
GET/api/v1/response-cache/capabilitiesBackend capabilities
GET/api/v1/response-cache/healthBackend health
GET/api/v1/response-cache/statsRedacted statistics
GET/api/v1/response-cache/auditRedacted mutation audit entries
POST/api/v1/response-cache/testValidate and probe a candidate configuration
POST/api/v1/response-cache/invalidateDry-run or invalidate a scoped partition
POST/api/v1/response-cache/flushAdvance a scoped or global cache epoch

Prefer scoped invalidation and a dry run before a destructive cache mutation. Bearer roles distinguish read, invalidate, and broader cache-management permissions.

Inspect context compression

MethodPathUse
GET/api/v1/context-compression/capabilitiesRuntime capabilities
GET/api/v1/context-compression/healthRuntime health
GET/api/v1/context-compression/statsRedacted statistics
POST/api/v1/context-compression/previewPreview compression without persistence
POST/api/v1/context-compression/recovery/invalidateInvalidate a trusted recovery scope

Use preview to evaluate what would be retained before enabling compression on important traffic.

Inspect replay and submit outcomes

Router Replay is management-only. Its query endpoints and redaction model are described in Router API.

Router Learning can ingest an outcome linked to an owned replay record:

curl -sS http://localhost:8080/v1/router/outcomes \
-H "Authorization: Bearer ${VSR_MGMT_TOKEN}" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: feedback-123' \
-d '{
"replay_id": "replay_...",
"target": "model",
"verdict": "good_fit",
"score": 0.9
}'

replay_id, target, and verdict are required. The authenticated principal, not the optional source body field, determines provenance. Use a stable Idempotency-Key when a client may retry. Ingestion also requires an active Router Learning runtime and the learning.ingest permission when bearer auth is enabled.

API boundaries

  • The management API is an operational surface, not the public inference gateway.
  • Endpoint availability can depend on compiled features and enabled services.
  • The OpenAPI document describes shape, not the behavior of a particular model, store, or external backend.
  • Keep bearer tokens out of URLs and logs. Give automation only the permissions it needs.

Complete endpoint index

The following reference is generated from the Router's registered route catalog. Use it to scan every endpoint; use the task-oriented sections above for guidance and the running /openapi.json for exact schemas.

Discovery and health

MethodPathDescription
GET/healthHealth check endpoint
GET/readyReadiness endpoint that turns green only after startup completes
GET/startup-statusDetailed router startup and model-download status
GET/api/v1API discovery and documentation
GET/openapi.jsonOpenAPI 3.0 specification
GET/docsInteractive Swagger UI documentation

Classification and signals

MethodPathDescription
POST/api/v1/classify/intentClassify user queries into routing categories
POST/api/v1/classify/piiDetect personally identifiable information in text
POST/api/v1/classify/securityDetect jailbreak attempts and security threats
POST/api/v1/classify/fact-checkClassify if text needs fact-checking
POST/api/v1/classify/user-feedbackClassify user feedback type (satisfied, need_clarification, wrong_answer, want_different)
POST/api/v1/classify/combinedPerform combined classification (intent, PII, and security)
POST/api/v1/classify/batchBatch classification with configurable task_type parameter
POST/api/v1/evalEvaluate all configured signals regardless of decision usage
POST/api/v1/nliNatural language inference classification for premise and hypothesis pairs
POST/api/v1/embeddingsGenerate text and image embeddings
POST/api/v1/similarityCalculate pairwise text similarity
POST/api/v1/similarity/batchCalculate batch text-similarity matches

Models and metrics

MethodPathDescription
GET/info/modelsGet information about loaded models
GET/info/classifierGet classifier information and status (secrets redacted without secret_view)
GET/api/v1/embeddings/modelsGet information about loaded embedding models
GET/v1/modelsOpenAI-compatible model listing
GET/metrics/classificationGet classification metrics and statistics
POST/v1/router/outcomesSubmit Router Learning outcome feedback linked to a replay record

Router config and recipes

MethodPathDescription
GET/config/router/recipesList the default and named routing recipes with their entrypoints
POST/config/router/recipes/validateValidate a recipe mutation without writing or reloading config
GET/config/router/recipes/{name}Read one routing recipe and its entrypoints
PUT/config/router/recipes/{name}Atomically create or replace one routing recipe; requires If-Match
DELETE/config/router/recipes/{name}Delete an unreferenced named routing recipe; requires If-Match
GET/config/routerGet the current router config as JSON (secrets redacted without secret_view)
POST/config/router/validateValidate and normalize a router config without writing it
PATCH/config/routerMerge a router config update (validates, backs up, writes, triggers hot-reload)
PUT/config/routerReplace the router config (validates, backs up, writes, triggers hot-reload)
POST/config/router/rollbackRollback to a previous router config version
GET/config/router/versionsList available router config backup versions
GET/config/hashCompare persisted source, generated runtime, and active router config hashes

Knowledge bases

MethodPathDescription
GET/config/kbsList configured knowledge bases
POST/config/kbsCreate a managed knowledge base
GET/config/kbs/{name}Read a knowledge base
GET/config/kbs/{name}/map/metadataRead generated knowledge-base map metadata
GET/config/kbs/{name}/map/data.ndjsonStream generated knowledge-base map data as NDJSON
PUT/config/kbs/{name}Update a managed knowledge base
DELETE/config/kbs/{name}Delete a managed knowledge base

Memory, vector stores, and files

These require the corresponding service to be enabled; otherwise the API returns 503.

MethodPathDescription
GET/v1/memoryList long-term memories
DELETE/v1/memoryDelete memories by scope
GET/v1/memory/{id}Read one long-term memory
DELETE/v1/memory/{id}Delete one long-term memory
POST/v1/vector_storesCreate a vector store
GET/v1/vector_storesList vector stores
GET/v1/vector_stores/{id}Read a vector store
POST/v1/vector_stores/{id}Update a vector store
DELETE/v1/vector_stores/{id}Delete a vector store
POST/v1/vector_stores/{id}/searchSearch a vector store
POST/v1/vector_stores/{id}/filesAttach a file to a vector store
GET/v1/vector_stores/{id}/filesList files attached to a vector store
DELETE/v1/vector_stores/{id}/files/{file_id}Detach a file from a vector store
POST/v1/filesUpload a file
GET/v1/filesList uploaded files
GET/v1/files/{id}Read uploaded-file metadata
DELETE/v1/files/{id}Delete an uploaded file
GET/v1/files/{id}/contentDownload uploaded-file content

Other endpoints

MethodPathDescription
GET/v1/router_replayList Router Replay records
GET/v1/router_replay/List Router Replay records (trailing-slash compatibility)
GET/v1/router_replay/aggregateAggregate Router Replay routing and cost metadata
GET/v1/router_replay/trajectoryBuild a Router Replay session trajectory
GET/v1/router_replay/{id}Read one Router Replay record
GET/api/v1/response-cache/capabilitiesGet response-cache backend capabilities
GET/api/v1/response-cache/healthCheck response-cache backend health
GET/api/v1/response-cache/statsGet redacted response-cache statistics
GET/api/v1/response-cache/auditGet redacted response-cache mutation audit entries
POST/api/v1/response-cache/testValidate and probe a response-cache candidate configuration
POST/api/v1/response-cache/invalidateDry-run or invalidate a scoped response-cache partition
POST/api/v1/response-cache/flushAdvance a scoped or global response-cache epoch
GET/api/v1/context-compression/capabilitiesGet context-compression capabilities
GET/api/v1/context-compression/healthCheck context-compression runtime health
GET/api/v1/context-compression/statsGet redacted context-compression statistics
POST/api/v1/context-compression/previewPreview context compression without persistence
POST/api/v1/context-compression/recovery/invalidateInvalidate a trusted context-recovery request scope