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(vercel): preserve provider error status
MagMuellere0737a614f5d
diff --git a/browser_use/llm/vercel/chat.py b/browser_use/llm/vercel/chat.pyindex 1d1b4e3af..048364969 100644--- a/browser_use/llm/vercel/chat.py+++ b/browser_use/llm/vercel/chat.py@@ -667,6 +667,9 @@ class ChatVercel(BaseChatModel):stop_reason=response.choices[0].finish_reason if response.choices else None,)+ except ModelProviderError:+ raise+except RateLimitError as e:raise ModelRateLimitError(message=e.message, model=self.name) from ediff --git a/tests/ci/models/test_llm_vercel.py b/tests/ci/models/test_llm_vercel.pyindex 5a5af5faf..58f5c418f 100644--- a/tests/ci/models/test_llm_vercel.py+++ b/tests/ci/models/test_llm_vercel.py@@ -6,7 +6,7 @@ from browser_use.llm.exceptions import ModelProviderErrorfrom browser_use.llm.vercel.chat import ChatVercel-def test_provider_key_does_not_fall_back_to_openai_key(monkeypatch: pytest.MonkeyPatch):+async def test_provider_key_does_not_fall_back_to_openai_key(monkeypatch: pytest.MonkeyPatch):monkeypatch.setenv('OPENAI_API_KEY', 'wrong-provider-key')monkeypatch.setenv('AI_GATEWAY_API_KEY', 'gateway-key')assert ChatVercel(model='openai/gpt-4o').get_client().api_key == 'gateway-key'@@ -14,5 +14,5 @@ def test_provider_key_does_not_fall_back_to_openai_key(monkeypatch: pytest.Monkemonkeypatch.delenv('AI_GATEWAY_API_KEY')monkeypatch.delenv('VERCEL_OIDC_TOKEN', raising=False)with pytest.raises(ModelProviderError, match='Missing Vercel AI Gateway API key') as exc_info:- ChatVercel(model='openai/gpt-4o').get_client()+ await ChatVercel(model='openai/gpt-4o').ainvoke([])assert exc_info.value.status_code == 401