From 6f348f2f5aae6fd94e619096fa73a1abaac5a239 Mon Sep 17 00:00:00 2001 From: Shrey Pandya Date: Mon, 9 Mar 2026 11:04:04 -0700 Subject: [PATCH] Fix reasoning_effort error for GPT-5.1/5.2 models in local mode GPT-5.1 and GPT-5.2 reject reasoning_effort: "minimal" with error: "Unsupported value: 'reasoning_effort' does not support 'minimal'". Set reasoning_effort to "low" for these models to avoid the error. Co-Authored-By: Claude Opus 4.6 (1M context) --- stagehand/llm/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stagehand/llm/client.py b/stagehand/llm/client.py index 06dc9594..48d83dec 100644 --- a/stagehand/llm/client.py +++ b/stagehand/llm/client.py @@ -114,6 +114,11 @@ async def create_response( if "gpt-5" in completion_model: filtered_params["temperature"] = 1 + # GPT-5.1 and GPT-5.2 don't support "minimal" reasoning_effort. + # Set "low" for these models to avoid OpenAI API errors. + if "gpt-5.1" in completion_model or "gpt-5.2" in completion_model: + filtered_params["reasoning_effort"] = "low" + self.logger.debug( f"Calling litellm.acompletion with model={completion_model} and params: {filtered_params}", category="llm",