Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fix(llm): handle missing choices in openai proxy response
sudhanshu112233shukla4c81648d6803
diff --git a/browser_use/llm/openai/chat.py b/browser_use/llm/openai/chat.pyindex ed363c9fc..97bd68e17 100644--- a/browser_use/llm/openai/chat.py+++ b/browser_use/llm/openai/chat.py@@ -203,6 +203,12 @@ class ChatOpenAI(BaseChatModel):**model_params,)+ if not response.choices:+ raise ModelProviderError(+ message='Model response missing "choices" field. This can happen with incompatible proxies.',+ model=self.name,+ )+usage = self._get_usage(response)return ChatInvokeCompletion(completion=response.choices[0].message.content or '',@@ -246,6 +252,12 @@ class ChatOpenAI(BaseChatModel):**model_params,)+ if not response.choices:+ raise ModelProviderError(+ message='Model response missing "choices" field. This can happen with incompatible proxies.',+ model=self.name,+ )+if response.choices[0].message.content is None:raise ModelProviderError(message='Failed to parse structured output from model response',