Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

make reasoning_models a parameter

Magnus Müller2b0045feff67
diff --git a/browser_use/llm/openai/chat.py b/browser_use/llm/openai/chat.py
index 78821c394..d6b233a9a 100644
--- a/browser_use/llm/openai/chat.py
+++ b/browser_use/llm/openai/chat.py
@@ -20,18 +20,6 @@ from browser_use.llm.views import ChatInvokeCompletion, ChatInvokeUsage
T = TypeVar('T', bound=BaseModel)
-ReasoningModels: list[ChatModel | str] = [
- 'o4-mini',
- 'o3',
- 'o3-mini',
- 'o1',
- 'o1-pro',
- 'o3-pro',
- 'gpt-5',
- 'gpt-5-mini',
- 'gpt-5-nano',
-]
-
@dataclass
class ChatOpenAI(BaseChatModel):
@@ -67,6 +55,17 @@ class ChatOpenAI(BaseChatModel):
http_client: httpx.AsyncClient | None = None
_strict_response_validation: bool = False
max_completion_tokens: int | None = 4096
+ reasoning_models: list[ChatModel | str] | None = [
+ 'o4-mini',
+ 'o3',
+ 'o3-mini',
+ 'o1',
+ 'o1-pro',
+ 'o3-pro',
+ 'gpt-5',
+ 'gpt-5-mini',
+ 'gpt-5-nano',
+ ]
# Static
@property
@@ -180,7 +179,7 @@ class ChatOpenAI(BaseChatModel):
if self.service_tier is not None:
model_params['service_tier'] = self.service_tier
- if any(str(m).lower() in str(self.model).lower() for m in ReasoningModels):
+ if any(str(m).lower() in str(self.model).lower() for m in self.reasoning_models):
model_params['reasoning_effort'] = self.reasoning_effort
del model_params['temperature']
del model_params['frequency_penalty']