How do I use OpenRouter with browser-use for DeepSeek when it fails with 429 or 'Could not parse response'?
I'm using browser-use 0.1.35 on Ubuntu 22.04 and only have an OpenRouter API key, not a DeepSeek key. I configured ChatOpenAI with base_url='https://openrouter.ai/api/v1 (opens external site)' and model='deepseek/deepseek-chat', but the browser opens and nothing happens; the logs show 'Could not parse response' and HTTP 429 'Authentication Fails. Multiple 401 errors detected.' Is there a working way to use OpenRouter with browser-use?
Originally asked on GitHub: https://github.com/browser-use/browser-use/issues/567
6 answers
This issue is closed as completed, but no maintainer gave a fix; the information below is from community comments. Several users hit the same problem on browser-use 0.1.35 / Ubuntu 22.04. The reporter's
deepseek/deepseek-chatcall through OpenRouter failed withCould not parse response, then HTTP 429 with metadataAuthentication Fails. Multiple 401 errors detected. Another user got HTTP 404No endpoints found that support tool useforopenai/chatgpt-4o-latestanddeepseek/deepseek-r1. No one in the thread confirms a working OpenRouter + DeepSeek setup.Community findings:
- One user found that disabling vision and using a different OpenRouter model (Gemini Flash 2.0) worked for them, while another user later reported the same failure with an OpenRouter Gemini 2.0 Flash model.
- A detailed community workaround suggested installing
langchain-communityand using:
pythonfrom langchain_community.chat_models import ChatOpenAI llm = ChatOpenAI( model="google/gemini-2.0-pro-exp-02-05:free", openai_api_key=openrouter_api_key, openai_api_base="https://openrouter.ai/api/v1", temperature=0.0, max_tokens=4096, model_kwargs={"tool_choice": "auto"}, )The same comment proposed patching
convert_input_messages()inbrowser_use/agent/message_manager/utils.pyandget_next_action()in the Agent class, but the thread never confirms that the patched code works.General advice: use an OpenRouter model that documents tool-use support, and keep the API key in an environment variable instead of hard-coding it in the script.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reporter used ChatOpenAI from langchain_openai with base_url='https://openrouter.ai/api/v1 (opens external site)', model='deepseek/deepseek-chat', api_key='sk-or-v1-xxx', and use_vision=False. The browser opened but stayed empty; logs showed 'Could not parse response' then HTTP 429 'Authentication Fails. Multiple 401 errors detected'.
Source: https://github.com/browser-use/browser-use/issues/567 (opens external site)
Did this work for you?What @prigozhinfan tried on GitHub (Didn't work)
Another user tried openai/chatgpt-4o-latest and deepseek/deepseek-r1 through OpenRouter and got HTTP 404 'No endpoints found that support tool use'. deepseek/deepseek-chat worked the day before but then started failing with 'Could not parse response'.
Source: https://github.com/browser-use/browser-use/issues/567#issuecomment-2640555911 (opens external site)
Did this work for you?What @kazGuido tried on GitHub (Worked)
One commenter reported that disabling vision and using a different OpenRouter model (Gemini Flash 2.0) worked, while DeepSeek via OpenRouter did not.
Source: https://github.com/browser-use/browser-use/issues/567#issuecomment-2663165027 (opens external site)
Did this work for you?What @agn-7 tried on GitHub (Didn't work)
Another user tested an OpenRouter Gemini 2.0 Flash model and got the same 'Could not parse response' style failure, so the earlier success was not reproduced.
Source: https://github.com/browser-use/browser-use/issues/567#issuecomment-2693475773 (opens external site)
Did this work for you?What @UnixSafe tried on GitHub (Outcome unclear)
A commenter posted a detailed workaround: install langchain-community, use ChatOpenAI with openai_api_base='https://openrouter.ai/api/v1 (opens external site)' and model='google/gemini-2.0-pro-exp-02-05:free', and patch browser-use's message conversion. The thread does not confirm the final result, and the get_next_action() change is cut off.
Source: https://github.com/browser-use/browser-use/issues/567#issuecomment-2710518976 (opens external site)
Did this work for you?
Related questions
- How to fix browser-use PostHog SSL CERTIFICATE_VERIFY_FAILED error?
- How to pause browser-use and ask a human for input mid-run?
- browser-use agent stuck at Step 1 with Chromium on about:blank page
- browser-use SSLError to eu.i.posthog.com: how do I disable the telemetry call?
- browser-use stuck at 'Step 1' with blank Chromium page, what causes it and how to fix it?