Skip to content

[Feat][Router] Add /v1/systemone and /v1/decisions routes - #1173

Merged
ruizhang0101 merged 2 commits into
vllm-project:mainfrom
shernshiou:feat/systemone
Oct 27, 2026
Merged

ruizhang0101 merged 2 commits into
vllm-project:mainfrom
shernshiou:feat/systemone

Conversation

@shernshiou

Copy link
Copy Markdown
Contributor

FIX #1165

Summary

The router now proxies vLLM's Structured Decisions endpoints: /v1/systemone (in vLLM 0.32.0) and /v1/decisions (on vLLM main, not yet released). Both request bodies carry model, so they reuse route_general_request unchanged, the same as /v1/score.

 main_router
   POST /v1/score      -> route_general_request
+  POST /v1/systemone  -> route_general_request
+  POST /v1/decisions  -> route_general_request

Under --routing-logic prefixaware, these bodies crashed with KeyError: 'prompt' (500), because they carry neither messages nor prompt. /v1/score, /v1/rerank, /v1/embeddings, and completions with a list prompt already crashed the same way. The second commit fixes that:

 PrefixAwareRouter.route_request
   if "messages": join message contents
   else:
-    prompt = request_json["prompt"]
+    prompt = prompt ?? state (systemone) ?? input (decisions/embeddings) ?? ""
+    if not str: json.dumps(prompt, sort_keys=True)   # HashTrie hashes strings

Keying on state sends repeat questions about the same state to the backend that already has it in prefix cache. That is what vLLM's --enable-prefix-caching guidance for this API relies on.

Not included: a decisions model type for --static-model-types (it only affects health probes, not routing) and a wildcard /v1/system* proxy (the router registers routes explicitly).

Evidence

Unit tests: 281 passed. New tests:

  • test_decisions_routes.py: both paths are registered and forward the right endpoint.
  • test_prefixaware_router.py: six body shapes route instead of raising, and a same-state request pins to the same backend. 6 of these fail without the fix.

E2E on an RTX 4090. Qwen/Qwen3-0.6B, two vLLM backends, router with --service-discovery static.

  • Before (7b1164d, the base): POST /v1/systemone and /v1/decisions return 404 from the router itself (zero Routing request log lines).
  • After, vLLM 0.32.0:
Check Result
/v1/systemone, round-robin 200, probabilities within 0.005 of calling the backend directly
/v1/systemone, prefix-aware 200 (was 500 KeyError)
completion with a list prompt, prefix-aware 200 (was 500)
missing model / unknown model 400 / 404, router messages unchanged
chat/completions, completions 200
10 requests with the same 411-char state, different questions all 10 → same backend
10 requests with different states split 3 / 7 across the backends
Traceback/KeyError in router logs 0
  • After, vLLM main (0.32.1rc1.dev326+gc722f3a53, which serves /v1/decisions): /v1/decisions returns 200 direct to the backend, through round-robin and through prefix-aware routing, with the same answer structure each time. 6 requests sharing one input pinned to one backend.

On vLLM 0.32.0 itself, /v1/decisions returns the backend's own 404, which the router passes through.

Merge Danger

Door: two-way

Additive routes plus a fallback in one branch of PrefixAwareRouter. Reverting either commit is clean.

Blast Radius: prefix-aware routing

Only --routing-logic prefixaware changes behaviour:

  • Non-chat bodies: requests that used to 500 (score, rerank, embeddings, list prompts, decisions) now route.
  • Embeddings: requests are now steered by prefix affinity on input.
  • Everything else: chat and string-prompt completions take the same path as before.

  • Make sure the code changes pass the pre-commit checks.
  • Sign-off your commit by using -s when doing git commit
  • Try to classify PRs for easy understanding of the type of changes, such as [Bugfix], [Feat], and [CI].

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the /v1/systemone and /v1/decisions endpoints, routing them through the general request handler. It also updates the prefix-aware routing logic to handle non-chat request shapes by extracting the prompt from state or input fields when prompt is absent, and serializing non-string values to JSON. A review comment points out that if any of these fields are explicitly set to null, they will be serialized to the string "null", potentially causing cache key collisions. It is recommended to handle None values explicitly.

@ruizhang0101 ruizhang0101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

shernshiou and others added 2 commits October 25, 2026 13:00
Proxy vLLM Structured Decisions endpoints through route_general_request,
like /v1/score. Both request bodies carry `model`, so existing routing
works unchanged.

Closes vllm-project#1165

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Shern Shiou Tan <[email protected]>
PrefixAwareRouter read request_json["prompt"] unguarded, so any body
without messages/prompt (/v1/systemone, /v1/decisions, /v1/embeddings,
/v1/score, /v1/rerank) raised KeyError and returned 500. Batched list
prompts also crashed the string-only HashTrie.

Fall back to `state` (systemone) then `input` (decisions/embeddings),
then "", and JSON-encode non-string values. Repeat systemone questions
over the same state now pin to the backend holding it in prefix cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Shern Shiou Tan <[email protected]>
@ruizhang0101
ruizhang0101 merged commit 2f879ef into vllm-project:main Oct 27, 2026
16 checks passed
@shernshiou
shernshiou deleted the feat/systemone branch October 27, 2026 06:46
bcdonadio added a commit to powerhome/vllm-production-stack that referenced this pull request Nov 12, 2026
* [Bugfix][Router] Read vllm:kv_cache_usage_perc for KV cache usage (vllm-project#1118)

Signed-off-by: Muhammad Ibrahim <[email protected]>

* [Doc] Add Simplified Chinese translation (README.zh.md) (vllm-project#1136)

Signed-off-by: YE <[email protected]>

* [CI/Build] Run helm unittest in CI and fix two broken tests (vllm-project#1131)

Signed-off-by: zjjkee <[email protected]>

* [Bugfix][Router] Key request stats by dispatch, not by X-Request-Id (vllm-project#1115)

Signed-off-by: David-Wu1119 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Rui Zhang <[email protected]>

* [Bugfix][Router] Use least-inflight for PrefixAware below-threshold fallback (vllm-project#1089)

Signed-off-by: Dundy Pasupuleti <[email protected]>

* [Bugfix][Router] Keep P/D model labels when dynamic config reloads the router (vllm-project#1129)

Signed-off-by: MinJun Choi <[email protected]>

* [Bugfix] Match KEDA scalers to enabled model deployments (vllm-project#1142)

Signed-off-by: bojiang-li <[email protected]>

* [Router] added pooling route (vllm-project#1112)

Signed-off-by: [email protected] <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Rui Zhang <[email protected]>

* [CI] Drop host docker prune from runner-cleanup workflow (vllm-project#1174)

Signed-off-by: Rui Zhang <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* [Feat][Router] Add /v1/systemone and /v1/decisions routes (vllm-project#1173)

Signed-off-by: Shern Shiou Tan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* [CI/Build] Stop k8s routing tests when the engine pods never become ready (vllm-project#1134)

Signed-off-by: MinJun Choi <[email protected]>

* [Bugfix][Router] Upgrade aiohttp and vllm (0.33.0) to resolve router image CVEs (vllm-project#1185)

Signed-off-by: Shern Shiou Tan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* Bump chart version to 0.1.14 (vllm-project#1190)

Signed-off-by: Rui Zhang <[email protected]>

---------

Signed-off-by: Muhammad Ibrahim <[email protected]>
Signed-off-by: YE <[email protected]>
Signed-off-by: zjjkee <[email protected]>
Signed-off-by: David-Wu1119 <[email protected]>
Signed-off-by: Dundy Pasupuleti <[email protected]>
Signed-off-by: MinJun Choi <[email protected]>
Signed-off-by: bojiang-li <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: Rui Zhang <[email protected]>
Signed-off-by: Shern Shiou Tan <[email protected]>
Signed-off-by: MinJun Choi <[email protected]>
Signed-off-by: Rui Zhang <[email protected]>
Signed-off-by: Bernardo Donadio <[email protected]>
Co-authored-by: Muhammad Ibrahim <[email protected]>
Co-authored-by: YE <[email protected]>
Co-authored-by: Jingke zou <[email protected]>
Co-authored-by: Yanze (David) Wu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Rui Zhang <[email protected]>
Co-authored-by: Dundy Pasupuleti <[email protected]>
Co-authored-by: MinJun Choi <[email protected]>
Co-authored-by: Bojiang Li <[email protected]>
Co-authored-by: MaelvanDijk <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Shern Shiou Tan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Add router support for vLLM Structured Decisions API (/v1/systemone)

2 participants