[Frontend] Apply request header overrides to chat completions (#35001)

Co-authored-by: Ye (Charlotte) Qi <ye.charlotte.qi@gmail.com>
This commit is contained in:
Lianmin Zheng
2026-08-16 15:08:47 -07:00
committed by GitHub
co-authored by Ye Qi
parent e49557b8da
commit 32e6fb4fdc
2 changed files with 56 additions and 0 deletions
@@ -61,6 +61,7 @@ from sglang.srt.entrypoints.openai.utils import (
should_include_usage,
to_openai_style_logprobs,
)
from sglang.srt.entrypoints.request_headers import apply_header_overrides
from sglang.srt.environ import envs
from sglang.srt.function_call.core_types import ToolCallItem
from sglang.srt.function_call.function_call_parser import FunctionCallParser
@@ -1037,6 +1038,11 @@ class OpenAIServingChat(OpenAIServingBase):
return_prompt_token_ids=request.return_prompt_token_ids
or request.return_token_ids,
)
if (
raw_request is not None
and envs.SGLANG_ENABLE_REQUEST_HEADER_OVERRIDES.get()
):
apply_header_overrides(adapted_request, raw_request.headers)
return adapted_request, request