Repository navigation
[None][feat] Add per-request priority support to OpenAI chat/completions - #7
Merged
Merged
Conversation
Expose the executor's per-request scheduling priority through the OpenAI frontend: accept 'priority' (float in [0,1], higher served first, engine default 0.5) on ChatCompletionRequest and CompletionRequest, and forward it to generate_async in openai_chat and openai_completion. Only honored when scheduler_config.waiting_queue_policy=priority; the default FCFS waiting queue ignores it. Validated on a 4xB300 canary (Kimi-K2.5-Turbo, 160-way saturation): HIGH(1.0) p50 TTFT 0.947s vs LOW(0.0) 2.857s (+66.8%), equal-priority control gap ~0. The mm_encoder and responses endpoints are intentionally not wired; deepapi only routes /v1/chat/completions and /v1/completions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Sihan Wang <sihan@deepinfra.com>
Thachnh
approved these changes
Jun 11, 2026
bo-deepinfra
pushed a commit
that referenced
this pull request
Jun 28, 2026
…ons (#7) Expose the executor's per-request scheduling priority through the OpenAI frontend: accept 'priority' (float in [0,1], higher served first, engine default 0.5) on ChatCompletionRequest and CompletionRequest, and forward it to generate_async in openai_chat and openai_completion. Only honored when scheduler_config.waiting_queue_policy=priority; the default FCFS waiting queue ignores it. Validated on a 4xB300 canary (Kimi-K2.5-Turbo, 160-way saturation): HIGH(1.0) p50 TTFT 0.947s vs LOW(0.0) 2.857s (+66.8%), equal-priority control gap ~0. The mm_encoder and responses endpoints are intentionally not wired; deepapi only routes /v1/chat/completions and /v1/completions. Signed-off-by: Sihan Wang <sihan@deepinfra.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expose the executor's per-request scheduling priority through the OpenAI frontend, so deepapi's
service_tier: "priority"can reach the TRT-LLM scheduler on pytrtllm models (vLLM models already have this path; pytrtllm was the gap).serve/openai_protocol.py: addpriority: Optional[float](pydantic-validated,ge=0.0, le=1.0) toChatCompletionRequestandCompletionRequest. Absent field →None→ engine default 0.5, so existing traffic is byte-for-byte unaffected.serve/openai_server.py: forward it togenerate_async(...)inopenai_chatandopenai_completion(the two endpoints deepapi routes pytrtllm traffic to, perget_llm_url).Everything below
generate_asyncalready exists upstream (Request.priority→PriorityWaitingQueue); this PR is only the missing frontend plumbing — same shape as the earlier per-requeststream_interval_ms(#5).Engine semantics (operators read this)
scheduler_config.waiting_queue_policy: "priority"in--extra_llm_api_options. The default FCFS waiting queue ignores the field (logs a warning). Do not tag a modelPRIORITYin deepapi until its deployment carries both this build and that config.Intentionally not wired
openai_mm_encoder,/v1/responses, and the gpt-oss harmony path keep their current behavior — deepapi routes pytrtllm LLM traffic exclusively to/v1/chat/completionsand/v1/completions. Can be added later if those paths ever need it.Validation
Patched canary image (
pytrtllm:rc16-priority-canary) on a manual 4xB300 deployment of Kimi-K2.5-Turbo (di-atl1-44, reserved GPUs),waiting_queue_policy=priority:"priority": 5→ 400 (le=1.0validation);1.0→ 200; absent → 200.py_compileclean on both files.Rebase notes
Both files are in the high-conflict set (
openai_protocol.py/openai_server.py). The hunks are small and context-anchored next tostream_interval_ms; on the next upstream bump re-fit is mechanical (rc11↔rc16 drift only required re-fitting theopenai_chatcall site, which gainedscheduling_paramsin rc16).🤖 Generated with Claude Code