diff --git a/python/sglang/srt/entrypoints/openai/protocol.py b/python/sglang/srt/entrypoints/openai/protocol.py index 9776cc682..7bf3581cf 100644 --- a/python/sglang/srt/entrypoints/openai/protocol.py +++ b/python/sglang/srt/entrypoints/openai/protocol.py @@ -721,7 +721,11 @@ class ChatCompletionRequest(BaseModel): ctk = values.get("chat_template_kwargs") if not isinstance(ctk, dict): ctk = {} + # different models check different keys: + # - "thinking" for deepseek-v3, kimi_k2 + # - "enable_thinking" for qwen3, glm45, nemotron_3, interns1, mimo ctk.setdefault("thinking", True) + ctk.setdefault("enable_thinking", True) values["chat_template_kwargs"] = ctk if values.get("reasoning_effort") == "none": diff --git a/test/registered/unit/entrypoints/openai/test_protocol.py b/test/registered/unit/entrypoints/openai/test_protocol.py index ee978f6a7..5cd33ecaa 100644 --- a/test/registered/unit/entrypoints/openai/test_protocol.py +++ b/test/registered/unit/entrypoints/openai/test_protocol.py @@ -191,7 +191,10 @@ class TestChatCompletionRequest(unittest.TestCase): }, ) self.assertEqual(request.reasoning_effort, "high") - self.assertEqual(request.chat_template_kwargs, {"thinking": True}) + self.assertEqual( + request.chat_template_kwargs, + {"thinking": True, "enable_thinking": True}, + ) def test_chat_completion_reasoning_effort_none(self): """Test reasoning_effort='none' disables thinking"""