Skip to content

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

update models to gpt-4.1

mertunsall220f0bc99460
diff --git a/.cursor/rules/browser-use-rules.mdc b/.cursor/rules/browser-use-rules.mdc
index c58b40ef3..235a51455 100644
--- a/.cursor/rules/browser-use-rules.mdc
+++ b/.cursor/rules/browser-use-rules.mdc
@@ -76,7 +76,7 @@ from browser_use import Agent
from browser_use.llm import ChatOpenAI
task = "Find the CEO of OpenAI and return their name"
-model = ChatOpenAI(model="gpt-4o")
+model = ChatOpenAI(model="gpt-4.1-mini")
agent = Agent(task=task, llm=model, controller=controller)
diff --git a/.github/ISSUE_TEMPLATE/1_element_detection_bug.yml b/.github/ISSUE_TEMPLATE/1_element_detection_bug.yml
index cd38ab813..80fbe6035 100644
--- a/.github/ISSUE_TEMPLATE/1_element_detection_bug.yml
+++ b/.github/ISSUE_TEMPLATE/1_element_detection_bug.yml
@@ -44,6 +44,8 @@ body:
- gpt-4.1
- gpt-4.1-mini
- gpt-4.1-nano
+ - o4-mini
+ - o3
- claude-3.7-sonnet
- claude-3.5-sonnet
- gemini-2.6-flash-preview
@@ -114,7 +116,7 @@ body:
agent = Agent(
task='...',
- llm=ChatOpenAI(model="gpt-4o"),
+ llm=ChatOpenAI(model="gpt-4.1"),
browser_session=BrowserSession(headless=False),
)
...
diff --git a/README.md b/README.md
index ae8bb36a1..5aa03ae83 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ from browser_use.llm import ChatOpenAI
async def main():
agent = Agent(
task="Compare the price of gpt-4o and DeepSeek-V3",
- llm=ChatOpenAI(model="gpt-4o"),
+ llm=ChatOpenAI(model="o4-mini", temperature=1.0),
)
await agent.run()
diff --git a/browser_use/cli.py b/browser_use/cli.py
index 17d5199bc..25bc173c9 100644
--- a/browser_use/cli.py
+++ b/browser_use/cli.py
@@ -211,11 +211,11 @@ def get_llm(config: dict[str, Any]):
# Auto-detect based on available API keys
if CONFIG.OPENAI_API_KEY:
- return ChatOpenAI(model='gpt-4o', temperature=temperature)
+ return ChatOpenAI(model='gpt-4.1', temperature=temperature)
elif CONFIG.ANTHROPIC_API_KEY:
- return ChatAnthropic(model='claude-3.5-sonnet-exp', temperature=temperature)
+ return ChatAnthropic(model='claude-3.5-sonnet', temperature=temperature)
elif CONFIG.GOOGLE_API_KEY:
- return ChatGoogle(model='gemini-2.0-flash-lite', temperature=temperature)
+ return ChatGoogle(model='gemini-2.5-flash', temperature=temperature)
else:
print(
'⚠️ No API keys found. Please update your config or set one of: OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY.'
diff --git a/browser_use/llm/tests/test_single_step.py b/browser_use/llm/tests/test_single_step.py
index 315afe9ee..b990804b6 100644
--- a/browser_use/llm/tests/test_single_step.py
+++ b/browser_use/llm/tests/test_single_step.py
@@ -95,9 +95,9 @@ def create_mock_state_message(temp_dir: str):
[
(ChatGroq, 'meta-llama/llama-4-maverick-17b-128e-instruct'),
(ChatGoogle, 'gemini-2.0-flash-exp'),
- (ChatOpenAI, 'gpt-4o-mini'),
+ (ChatOpenAI, 'gpt-4.1-mini'),
(ChatAnthropic, 'claude-3-5-sonnet-latest'),
- (ChatAzureOpenAI, 'gpt-4o-mini'),
+ (ChatAzureOpenAI, 'gpt-4.1-mini'),
],
)
async def test_single_step_parametrized(llm_class, model_name):
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index 3682424af..26382eee3 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -50,7 +50,7 @@ load_dotenv()
import asyncio
-llm = ChatOpenAI(model="gpt-4o")
+llm = ChatOpenAI(model="gpt-4.1")
async def main():
agent = Agent(
diff --git a/eval/service.py b/eval/service.py
index 41e8d5a52..3d7163422 100644
--- a/eval/service.py
+++ b/eval/service.py
@@ -3039,7 +3039,7 @@ if __name__ == '__main__':
'--model', type=str, default='gpt-4o', choices=list(SUPPORTED_MODELS.keys()), help='Model to use for the agent'
)
parser.add_argument(
- '--eval-model', type=str, default='gpt-4o', choices=list(SUPPORTED_MODELS.keys()), help='Model to use for evaluation'
+ '--eval-model', type=str, default='gpt-4.1', choices=list(SUPPORTED_MODELS.keys()), help='Model to use for evaluation'
)
parser.add_argument('--no-vision', action='store_true', help='Disable vision capabilities in the agent')
diff --git a/examples/browser/multiple_agents_same_browser.py b/examples/browser/multiple_agents_same_browser.py
index 1205fcfa5..354c292cf 100644
--- a/examples/browser/multiple_agents_same_browser.py
+++ b/examples/browser/multiple_agents_same_browser.py
@@ -26,7 +26,7 @@ async def main():
await browser_session.start()
current_agent = None
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
task1 = 'find todays weather on San Francisco and extract it as json'
task2 = 'find todays weather in Zurich and extract it as json'
diff --git a/examples/browser/real_browser.py b/examples/browser/real_browser.py
index d3ad39435..e232ebea2 100644
--- a/examples/browser/real_browser.py
+++ b/examples/browser/real_browser.py
@@ -24,7 +24,7 @@ browser_session = BrowserSession(browser_profile=browser_profile)
async def main():
agent = Agent(
task='Find todays DOW stock price',
- llm=ChatOpenAI(model='gpt-4o'),
+ llm=ChatOpenAI(model='gpt-4.1'),
browser_session=browser_session,
)
diff --git a/examples/browser/stealth.py b/examples/browser/stealth.py
index be2f0485c..73ac7366a 100644
--- a/examples/browser/stealth.py
+++ b/examples/browser/stealth.py
@@ -18,7 +18,7 @@ from browser_use.browser.profile import BrowserProfile
from browser_use.browser.types import async_patchright
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
terminal_width, terminal_height = shutil.get_terminal_size((80, 20))
diff --git a/examples/custom-functions/2fa.py b/examples/custom-functions/2fa.py
index f5d4e537d..7622fab70 100644
--- a/examples/custom-functions/2fa.py
+++ b/examples/custom-functions/2fa.py
@@ -56,7 +56,7 @@ async def main():
You are completely FORBIDDEN to use any other method to get the 2FA code.
"""
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller)
result = await agent.run()
diff --git a/examples/custom-functions/action_filters.py b/examples/custom-functions/action_filters.py
index 619d6ed94..f7a7ef41b 100644
--- a/examples/custom-functions/action_filters.py
+++ b/examples/custom-functions/action_filters.py
@@ -68,7 +68,7 @@ async def main():
"""Main function to run the example"""
browser_session = BrowserSession()
await browser_session.start()
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
# Create the agent
agent = Agent( # disco mode will not be triggered on apple.com because the LLM won't be able to see that action available, it should work on Google.com though.
diff --git a/examples/custom-functions/advanced_search.py b/examples/custom-functions/advanced_search.py
index 491c368de..efeae01d1 100644
--- a/examples/custom-functions/advanced_search.py
+++ b/examples/custom-functions/advanced_search.py
@@ -93,7 +93,7 @@ names = [
async def main():
task = 'use search_web with "find email address of the following ETH professor:" for each of the following persons in a list of actions. Finally return the list with name and email if provided - do always 5 at once'
task += '\n' + '\n'.join(names)
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
browser_profile = BrowserProfile()
agent = Agent(task=task, llm=model, controller=controller, browser_profile=browser_profile)
diff --git a/examples/custom-functions/clipboard.py b/examples/custom-functions/clipboard.py
index 5f5d82cc1..33e1d615d 100644
--- a/examples/custom-functions/clipboard.py
+++ b/examples/custom-functions/clipboard.py
@@ -39,7 +39,7 @@ async def paste_from_clipboard(page: Page):
async def main():
task = 'Copy the text "Hello, world!" to the clipboard, then go to google.com and paste the text'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
browser_session = BrowserSession(browser_profile=browser_profile)
await browser_session.start()
agent = Agent(
diff --git a/examples/custom-functions/custom_hooks_before_after_step.py b/examples/custom-functions/custom_hooks_before_after_step.py
index 8d4c7b873..bd40acbbf 100644
--- a/examples/custom-functions/custom_hooks_before_after_step.py
+++ b/examples/custom-functions/custom_hooks_before_after_step.py
@@ -220,8 +220,8 @@ async def record_activity(agent_obj):
agent = Agent(
- task='Compare the price of gpt-4o and DeepSeek-V3',
- llm=ChatOpenAI(model='gpt-4o'),
+ task='Compare the price of gpt-4.1 and DeepSeek-V3',
+ llm=ChatOpenAI(model='gpt-4.1'),
)
diff --git a/examples/custom-functions/drag_and_drop.py b/examples/custom-functions/drag_and_drop.py
index 22763142a..a8a6a588b 100644
--- a/examples/custom-functions/drag_and_drop.py
+++ b/examples/custom-functions/drag_and_drop.py
@@ -268,7 +268,7 @@ async def example_drag_drop_sortable_list():
controller = await create_drag_drop_controller()
# Initialize LLM (replace with your preferred model)
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
# Create the agent
agent = Agent(
@@ -288,7 +288,7 @@ async def example_drag_drop_coordinates():
"""Example: Direct coordinate-based drag and drop."""
controller = await create_drag_drop_controller()
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
agent = Agent(
task='Go to a canvas drawing website and draw a simple line using drag and drop from coordinates (100, 100) to (300, 200)',
diff --git a/examples/custom-functions/extract_pdf_content.py b/examples/custom-functions/extract_pdf_content.py
index 87048b707..0dc451f34 100755
--- a/examples/custom-functions/extract_pdf_content.py
+++ b/examples/custom-functions/extract_pdf_content.py
@@ -79,7 +79,7 @@ async def main():
URL: https://docs.house.gov/meetings/GO/GO00/20220929/115171/HHRG-117-GO00-20220929-SD010.pdf
""",
- llm=ChatOpenAI(model='gpt-4o'),
+ llm=ChatOpenAI(model='gpt-4.1'),
controller=controller,
)
result = await agent.run()
diff --git a/examples/custom-functions/hover_element.py b/examples/custom-functions/hover_element.py
index 4ff3826fb..d363ba058 100644
--- a/examples/custom-functions/hover_element.py
+++ b/examples/custom-functions/hover_element.py
@@ -74,7 +74,7 @@ async def hover_element(params: HoverAction, browser_session: BrowserSession):
async def main():
task = 'Open https://testpages.eviltester.com/styled/csspseudo/css-hover.html and hover the element with the css selector #hoverdivpara, then click on "Can you click me?"'
# task = 'Open https://testpages.eviltester.com/styled/csspseudo/css-hover.html and hover the element with the xpath //*[@id="hoverdivpara"], then click on "Can you click me?"'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
browser_session = BrowserSession(browser_profile=browser_profile)
await browser_session.start()
agent = Agent(
diff --git a/examples/custom-functions/notification.py b/examples/custom-functions/notification.py
index 0d9f780a4..325f30c17 100644
--- a/examples/custom-functions/notification.py
+++ b/examples/custom-functions/notification.py
@@ -34,7 +34,7 @@ async def done(text: str):
async def main():
task = 'go to brower-use.com and then done'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller)
await agent.run()
diff --git a/examples/custom-functions/onepassword_2fa.py b/examples/custom-functions/onepassword_2fa.py
index c34fd19b0..5b73d88a6 100644
--- a/examples/custom-functions/onepassword_2fa.py
+++ b/examples/custom-functions/onepassword_2fa.py
@@ -46,7 +46,7 @@ async def main():
# Example task using the 1Password 2FA action
task = 'Go to account.google.com, enter username and password, then if prompted for 2FA code, get 2FA code from 1Password for and enter it'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller)
result = await agent.run()
diff --git a/examples/custom-functions/perplexity_search.py b/examples/custom-functions/perplexity_search.py
index b306d5d2a..253d42733 100644
--- a/examples/custom-functions/perplexity_search.py
+++ b/examples/custom-functions/perplexity_search.py
@@ -71,7 +71,7 @@ names = [
async def main():
task = 'use search_web with "find email address of the following ETH professor:" for each of the persons. Finally return the list with name and email if provided '
task += '\n' + '\n'.join(names)
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
browser_profile = BrowserProfile()
agent = Agent(task=task, llm=model, controller=controller, browser_profile=browser_profile)
diff --git a/examples/custom-functions/save_to_file_hugging_face.py b/examples/custom-functions/save_to_file_hugging_face.py
index 284018cc3..dbfd280f8 100644
--- a/examples/custom-functions/save_to_file_hugging_face.py
+++ b/examples/custom-functions/save_to_file_hugging_face.py
@@ -40,7 +40,7 @@ def save_models(params: Models):
async def main():
task = 'Look up models with a license of cc-by-sa-4.0 and sort by most likes on Hugging face, save top 5 to file.'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller)
await agent.run()
diff --git a/examples/custom-functions/solve_amazon_captcha.py b/examples/custom-functions/solve_amazon_captcha.py
index f3edbf458..27ab02e0f 100644
--- a/examples/custom-functions/solve_amazon_captcha.py
+++ b/examples/custom-functions/solve_amazon_captcha.py
@@ -71,7 +71,7 @@ async def solve_amazon_captcha(browser_session: BrowserSession):
async def main():
task = 'Go to https://www.amazon.com/errors/validateCaptcha and solve the captcha using the solve_amazon_captcha tool'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
browser_session = BrowserSession(browser_profile=browser_profile)
await browser_session.start()
agent = Agent(task=task, llm=model, controller=controller, browser_session=browser_session)
diff --git a/examples/features/click_fallback_options.py b/examples/features/click_fallback_options.py
index e5306185a..0f65f68bf 100644
--- a/examples/features/click_fallback_options.py
+++ b/examples/features/click_fallback_options.py
@@ -181,7 +181,7 @@ async def main():
select_task = 'Open http://localhost:8000/, choose the car BMW'
button_task = 'Open http://localhost:8000/, click on the button'
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
# llm = ChatGoogleGenerativeAI(
# model="gemini-2.0-flash-lite",
# )
diff --git a/examples/features/cross_origin_iframes.py b/examples/features/cross_origin_iframes.py
index 5a186e253..abdd9190c 100644
--- a/examples/features/cross_origin_iframes.py
+++ b/examples/features/cross_origin_iframes.py
@@ -32,7 +32,7 @@ controller = Controller()
async def main():
agent = Agent(
task='Click "Go cross-site (simple page)" button on https://csreis.github.io/tests/cross-site-iframe.html then tell me the text within',
- llm=ChatOpenAI(model='gpt-4o', temperature=0.0),
+ llm=ChatOpenAI(model='gpt-4.1', temperature=0.0),
controller=controller,
browser_session=browser_session,
)
diff --git a/examples/features/custom_output.py b/examples/features/custom_output.py
index 165e36901..40319afd0 100644
--- a/examples/features/custom_output.py
+++ b/examples/features/custom_output.py
@@ -36,7 +36,7 @@ controller = Controller(output_model=Posts)
async def main():
task = 'Go to hackernews show hn and give me the first 5 posts'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller)
history = await agent.run()
diff --git a/examples/features/custom_system_prompt.py b/examples/features/custom_system_prompt.py
index c0770bb72..f28d4690f 100644
--- a/examples/features/custom_system_prompt.py
+++ b/examples/features/custom_system_prompt.py
@@ -29,7 +29,7 @@ extend_system_message = (
async def main():
task = 'do google search to find images of Elon Musk'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, extend_system_message=extend_system_message)
print(
diff --git a/examples/features/custom_user_agent.py b/examples/features/custom_user_agent.py
index 9e05abaa6..82790a5e3 100644
--- a/examples/features/custom_user_agent.py
+++ b/examples/features/custom_user_agent.py
@@ -19,7 +19,7 @@ def get_llm(provider: str):
if provider == 'anthropic':
return ChatAnthropic(model='claude-3-5-sonnet-20240620', temperature=0.0)
elif provider == 'openai':
- return ChatOpenAI(model='gpt-4o', temperature=0.0)
+ return ChatOpenAI(model='gpt-4.1', temperature=0.0)
else:
raise ValueError(f'Unsupported provider: {provider}')
diff --git a/examples/features/follow_up_tasks.py b/examples/features/follow_up_tasks.py
index 93f448207..750bcf3b7 100644
--- a/examples/features/follow_up_tasks.py
+++ b/examples/features/follow_up_tasks.py
@@ -14,7 +14,7 @@ from browser_use.llm import ChatOpenAI
# Initialize the model
llm = ChatOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
temperature=0.0,
)
# Get your chrome path
diff --git a/examples/features/initial_actions.py b/examples/features/initial_actions.py
index 2138bcfc7..49cdab022 100644
--- a/examples/features/initial_actions.py
+++ b/examples/features/initial_actions.py
@@ -11,7 +11,7 @@ load_dotenv()
from browser_use import Agent
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
initial_actions = [
{'go_to_url': {'url': 'https://www.google.com', 'new_tab': True}},
diff --git a/examples/features/multi-tab_handling.py b/examples/features/multi-tab_handling.py
index fa4d38447..9a83d0be5 100644
--- a/examples/features/multi-tab_handling.py
+++ b/examples/features/multi-tab_handling.py
@@ -18,7 +18,7 @@ from browser_use import Agent
from browser_use.llm import ChatOpenAI
# video: https://preview.screen.studio/share/clenCmS6
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
agent = Agent(
task='open 3 tabs with elon musk, trump, and steve jobs, then go back to the first and stop',
llm=llm,
diff --git a/examples/features/outsource_state.py b/examples/features/outsource_state.py
index 821d84250..a030c8b91 100644
--- a/examples/features/outsource_state.py
+++ b/examples/features/outsource_state.py
@@ -35,10 +35,10 @@ async def main():
for i in range(10):
agent = Agent(
task=task,
- llm=ChatOpenAI(model='gpt-4o'),
+ llm=ChatOpenAI(model='gpt-4.1'),
browser_session=browser_session,
injected_agent_state=agent_state,
- page_extraction_llm=ChatOpenAI(model='gpt-4o-mini'),
+ page_extraction_llm=ChatOpenAI(model='gpt-4.1-mini'),
)
done, valid = await agent.take_step()
diff --git a/examples/features/parallel_agents.py b/examples/features/parallel_agents.py
index 39e957fbc..97b417242 100644
--- a/examples/features/parallel_agents.py
+++ b/examples/features/parallel_agents.py
@@ -20,7 +20,7 @@ browser_session = BrowserSession(
user_data_dir='~/.config/browseruse/profiles/default',
)
)
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
async def main():
diff --git a/examples/features/pause_agent.py b/examples/features/pause_agent.py
index cced99efc..914c528a6 100644
--- a/examples/features/pause_agent.py
+++ b/examples/features/pause_agent.py
@@ -15,7 +15,7 @@ from browser_use.llm import ChatOpenAI
class AgentController:
def __init__(self):
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
self.agent = Agent(
task='open in one action https://www.google.com, https://www.wikipedia.org, https://www.youtube.com, https://www.github.com, https://amazon.com',
llm=llm,
diff --git a/examples/features/planner.py b/examples/features/planner.py
index e528a81a2..cf7ecb2d4 100644
--- a/examples/features/planner.py
+++ b/examples/features/planner.py
@@ -11,7 +11,7 @@ load_dotenv()
from browser_use import Agent
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o', temperature=0.0)
+llm = ChatOpenAI(model='gpt-4.1', temperature=0.0)
planner_llm = ChatOpenAI(
model='o3-mini',
)
diff --git a/examples/features/restrict_urls.py b/examples/features/restrict_urls.py
index 6383793b8..9269cc38f 100644
--- a/examples/features/restrict_urls.py
+++ b/examples/features/restrict_urls.py
@@ -12,7 +12,7 @@ from browser_use import Agent
from browser_use.browser import BrowserProfile, BrowserSession
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o', temperature=0.0)
+llm = ChatOpenAI(model='gpt-4.1', temperature=0.0)
task = (
"go to google.com and search for openai.com and click on the first link then extract content and scroll down - what's there?"
)
diff --git a/examples/features/result_processing.py b/examples/features/result_processing.py
index 6030c6083..d4d9aa3da 100644
--- a/examples/features/result_processing.py
+++ b/examples/features/result_processing.py
@@ -14,7 +14,7 @@ from browser_use.agent.views import AgentHistoryList
from browser_use.browser import BrowserProfile, BrowserSession
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
async def main():
diff --git a/examples/features/save_trace.py b/examples/features/save_trace.py
index 6e93fb2ee..3e9caa100 100644
--- a/examples/features/save_trace.py
+++ b/examples/features/save_trace.py
@@ -12,7 +12,7 @@ from browser_use.agent.service import Agent
from browser_use.browser import BrowserProfile, BrowserSession
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o', temperature=0.0)
+llm = ChatOpenAI(model='gpt-4.1', temperature=0.0)
async def main():
diff --git a/examples/features/small_model_for_extraction.py b/examples/features/small_model_for_extraction.py
index f0c1335bd..73e60a92e 100644
--- a/examples/features/small_model_for_extraction.py
+++ b/examples/features/small_model_for_extraction.py
@@ -11,8 +11,8 @@ load_dotenv()
from browser_use import Agent
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o', temperature=0.0)
-small_llm = ChatOpenAI(model='gpt-4o-mini', temperature=0.0)
+llm = ChatOpenAI(model='gpt-4.1', temperature=0.0)
+small_llm = ChatOpenAI(model='gpt-4.1-mini', temperature=0.0)
task = 'Find the founders of browser-use in ycombinator, extract all links and open the links one by one'
agent = Agent(task=task, llm=llm, page_extraction_llm=small_llm)
diff --git a/examples/features/validate_output.py b/examples/features/validate_output.py
index c3bd5b558..ee592db3c 100644
--- a/examples/features/validate_output.py
+++ b/examples/features/validate_output.py
@@ -39,7 +39,7 @@ async def done(params: DoneResult):
async def main():
task = 'Go to hackernews hn and give me the top 1 post'
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller, validate_output=True)
# NOTE: this should fail to demonstrate the validator
await agent.run(max_steps=5)
diff --git a/examples/integrations/gmail_2fa_integration.py b/examples/integrations/gmail_2fa_integration.py
index 35843c8f6..18e13e4d6 100644
--- a/examples/integrations/gmail_2fa_integration.py
+++ b/examples/integrations/gmail_2fa_integration.py
@@ -43,7 +43,7 @@ async def main():
print()
# Initialize LLM
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
# Example 1: Basic Gmail authentication test
print('📧 Testing Gmail authentication...')
diff --git a/examples/models/azure_openai.py b/examples/models/azure_openai.py
index 4619b830b..c5d923670 100644
--- a/examples/models/azure_openai.py
+++ b/examples/models/azure_openai.py
@@ -27,7 +27,7 @@ if not azure_openai_api_key or not azure_openai_endpoint:
# Initialize the Azure OpenAI client
llm = ChatAzureOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
api_key=azure_openai_api_key,
azure_endpoint=azure_openai_endpoint, # Corrected to use azure_endpoint instead of openai_api_base
)
diff --git a/examples/models/langchain/README.md b/examples/models/langchain/README.md
index 52eb6880d..d05bacc22 100644
--- a/examples/models/langchain/README.md
+++ b/examples/models/langchain/README.md
@@ -15,7 +15,7 @@ async def main():
# Create a LangChain model (OpenAI)
langchain_model = ChatOpenAI(
- model='gpt-4o-mini',
+ model='gpt-4.1-mini',
temperature=0.1,
)
diff --git a/examples/models/langchain/example.py b/examples/models/langchain/example.py
index 03aaf43b4..9d308f296 100644
--- a/examples/models/langchain/example.py
+++ b/examples/models/langchain/example.py
@@ -25,7 +25,7 @@ async def main():
# Create a LangChain model (OpenAI)
langchain_model = ChatOpenAI(
- model='gpt-4o-mini',
+ model='gpt-4.1-mini',
temperature=0.1,
)
diff --git a/examples/ui/command_line.py b/examples/ui/command_line.py
index dfe5c1c46..cc2efa33c 100644
--- a/examples/ui/command_line.py
+++ b/examples/ui/command_line.py
@@ -45,7 +45,7 @@ def get_llm(provider: str):
if not api_key:
raise ValueError('Error: OPENAI_API_KEY is not set. Please provide a valid API key.')
- return ChatOpenAI(model='gpt-4o', temperature=0.0)
+ return ChatOpenAI(model='gpt-4.1', temperature=0.0)
else:
raise ValueError(f'Unsupported provider: {provider}')
diff --git a/examples/ui/gradio_demo.py b/examples/ui/gradio_demo.py
index 3961f7678..53f65ba8c 100644
--- a/examples/ui/gradio_demo.py
+++ b/examples/ui/gradio_demo.py
@@ -59,7 +59,7 @@ def parse_agent_history(history_str: str) -> None:
async def run_browser_task(
task: str,
api_key: str,
- model: str = 'gpt-4o',
+ model: str = 'gpt-4.1',
headless: bool = True,
) -> str:
if not api_key.strip():
@@ -70,7 +70,7 @@ async def run_browser_task(
try:
agent = Agent(
task=task,
- llm=ChatOpenAI(model='gpt-4o'),
+ llm=ChatOpenAI(model='gpt-4.1'),
)
result = await agent.run()
# TODO: The result could be parsed better
diff --git a/examples/ui/streamlit_demo.py b/examples/ui/streamlit_demo.py
index 2171f22bb..4d85792b9 100644
--- a/examples/ui/streamlit_demo.py
+++ b/examples/ui/streamlit_demo.py
@@ -44,7 +44,7 @@ def get_llm(provider: str):
st.error('Error: OPENAI_API_KEY is not set. Please provide a valid API key.')
st.stop()
- return ChatOpenAI(model='gpt-4o', temperature=0.0)
+ return ChatOpenAI(model='gpt-4.1', temperature=0.0)
else:
st.error(f'Unsupported provider: {provider}')
st.stop()
diff --git a/examples/use-cases/captcha.py b/examples/use-cases/captcha.py
index 9c012cd97..c0104f8e6 100644
--- a/examples/use-cases/captcha.py
+++ b/examples/use-cases/captcha.py
@@ -26,7 +26,7 @@ if not os.getenv('OPENAI_API_KEY'):
async def main():
- llm = ChatOpenAI(model='gpt-4o')
+ llm = ChatOpenAI(model='gpt-4.1')
agent = Agent(
task='go to https://captcha.com/demos/features/captcha-demo.aspx and solve the captcha',
llm=llm,
diff --git a/examples/use-cases/check_appointment.py b/examples/use-cases/check_appointment.py
index b4c695d24..f01592a8f 100644
--- a/examples/use-cases/check_appointment.py
+++ b/examples/use-cases/check_appointment.py
@@ -42,7 +42,7 @@ async def main():
'If there is no available date in both months, tell me there is no available date.'
)
- model = ChatOpenAI(model='gpt-4o-mini')
+ model = ChatOpenAI(model='gpt-4.1-mini')
agent = Agent(task, model, controller=controller, use_vision=True)
await agent.run()
diff --git a/examples/use-cases/find_and_apply_to_jobs.py b/examples/use-cases/find_and_apply_to_jobs.py
index 9eeb30c0d..06bc8ad59 100644
--- a/examples/use-cases/find_and_apply_to_jobs.py
+++ b/examples/use-cases/find_and_apply_to_jobs.py
@@ -137,7 +137,7 @@ async def main():
# ground_task + '\n' + 'Meta',
]
model = ChatAzureOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
)
agents = []
diff --git a/examples/use-cases/find_influencer_profiles.py b/examples/use-cases/find_influencer_profiles.py
index 862cb4589..9b2567e0f 100644
--- a/examples/use-cases/find_influencer_profiles.py
+++ b/examples/use-cases/find_influencer_profiles.py
@@ -68,7 +68,7 @@ async def main():
'Go to this tiktok video url, open it and extract the @username from the resulting url. Then do a websearch for this username to find all his social media profiles. Return me the links to the social media profiles with the platform name.'
' https://www.tiktokv.com/share/video/7470981717659110678/ '
)
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
agent = Agent(task=task, llm=model, controller=controller)
history = await agent.run()
diff --git a/examples/use-cases/google_sheets.py b/examples/use-cases/google_sheets.py
index fec41880a..f0100da68 100644
--- a/examples/use-cases/google_sheets.py
+++ b/examples/use-cases/google_sheets.py
@@ -44,7 +44,7 @@ async def main():
)
async with browser_session:
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
# eraser = Agent(
# task="""
diff --git a/examples/use-cases/online_coding_agent.py b/examples/use-cases/online_coding_agent.py
index 59bd27eb1..d9f55e20d 100644
--- a/examples/use-cases/online_coding_agent.py
+++ b/examples/use-cases/online_coding_agent.py
@@ -20,7 +20,7 @@ if not os.getenv('OPENAI_API_KEY'):
async def main():
browser_session = BrowserSession()
- model = ChatOpenAI(model='gpt-4o')
+ model = ChatOpenAI(model='gpt-4.1')
# Initialize browser agent
agent1 = Agent(
diff --git a/examples/use-cases/play_chess.py b/examples/use-cases/play_chess.py
index 912932d21..2ebc464da 100755
--- a/examples/use-cases/play_chess.py
+++ b/examples/use-cases/play_chess.py
@@ -327,7 +327,7 @@ async def main():
8. Repeat steps 4-7 until the game ends. If anything seems wrong, use 'Read Chess Board' again.
9. Announce the final result.
""",
- llm=ChatOpenAI(model='gpt-4o'),
+ llm=ChatOpenAI(model='gpt-4.1'),
controller=controller,
)
result = await agent.run()
diff --git a/examples/use-cases/post-twitter.py b/examples/use-cases/post-twitter.py
index 0645be42f..7ea7347d0 100644
--- a/examples/use-cases/post-twitter.py
+++ b/examples/use-cases/post-twitter.py
@@ -49,7 +49,7 @@ class TwitterConfig:
message: str
reply_url: str
headless: bool = False
- model: str = 'gpt-4o-mini'
+ model: str = 'gpt-4.1-mini'
base_url: str = 'https://x.com/home'
diff --git a/examples/use-cases/scrolling_page.py b/examples/use-cases/scrolling_page.py
index 738ed475c..aaf754290 100644
--- a/examples/use-cases/scrolling_page.py
+++ b/examples/use-cases/scrolling_page.py
@@ -24,7 +24,7 @@ This script demonstrates how the agent can navigate to a webpage and scroll down
If no amount is specified, the agent will scroll down by one page height.
"""
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
browser_profile = BrowserProfile(headless=False)
browser_session = BrowserSession(browser_profile=browser_profile)
diff --git a/examples/use-cases/shopping.py b/examples/use-cases/shopping.py
index 331ed82fc..fda19db13 100644
--- a/examples/use-cases/shopping.py
+++ b/examples/use-cases/shopping.py
@@ -113,7 +113,7 @@ browser_session = BrowserSession()
agent = Agent(
task=task,
- llm=ChatOpenAI(model='gpt-4o'),
+ llm=ChatOpenAI(model='gpt-4.1'),
browser_session=browser_session,
)
diff --git a/examples/use-cases/web_voyager_agent.py b/examples/use-cases/web_voyager_agent.py
index c8ab09fba..74d678460 100644
--- a/examples/use-cases/web_voyager_agent.py
+++ b/examples/use-cases/web_voyager_agent.py
@@ -19,11 +19,11 @@ from browser_use.llm import ChatAzureOpenAI, ChatOpenAI
# Set LLM based on defined environment variables
if os.getenv('OPENAI_API_KEY'):
llm = ChatOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
)
elif os.getenv('AZURE_OPENAI_KEY') and os.getenv('AZURE_OPENAI_ENDPOINT'):
llm = ChatAzureOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
)
else:
raise ValueError('No LLM found. Please set OPENAI_API_KEY or AZURE_OPENAI_KEY and AZURE_OPENAI_ENDPOINT.')
diff --git a/examples/use-cases/wikipedia_banana_to_quantum.py b/examples/use-cases/wikipedia_banana_to_quantum.py
index 03fbc2eaa..e300a229d 100644
--- a/examples/use-cases/wikipedia_banana_to_quantum.py
+++ b/examples/use-cases/wikipedia_banana_to_quantum.py
@@ -14,7 +14,7 @@ from browser_use.llm import ChatOpenAI
# video https://preview.screen.studio/share/vuq91Ej8
llm = ChatOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
temperature=0.0,
)
task = 'go to https://en.wikipedia.org/wiki/Banana and click on buttons on the wikipedia page to go as fast as possible from banna to Quantum mechanics'
diff --git a/tests/ci/test_sync_agent_events.py b/tests/ci/test_sync_agent_events.py
index 5ebee94bf..fb6500048 100644
--- a/tests/ci/test_sync_agent_events.py
+++ b/tests/ci/test_sync_agent_events.py
@@ -404,7 +404,7 @@ class TestEventValidation:
user_id='0683fb03-c5da-79c9-8000-d3a39c47c650',
agent_session_id='0683fb03-c5da-79c9-8000-d3a39c47c651',
task='test',
- llm_model='gpt-4o',
+ llm_model='gpt-4.1',
done_output=None,
user_feedback_type=None,
user_comment=None,
diff --git a/tests/old/test_agent_actions.py b/tests/old/test_agent_actions.py
index 773a622de..9825133c3 100644
--- a/tests/old/test_agent_actions.py
+++ b/tests/old/test_agent_actions.py
@@ -13,9 +13,9 @@ def llm():
# return ChatAnthropic(model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None)
return ChatAzureOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
)
- # return ChatOpenAI(model='gpt-4o-mini')
+ # return ChatOpenAI(model='gpt-4.1-mini')
@pytest.fixture
diff --git a/tests/old/test_core_functionality.py b/tests/old/test_core_functionality.py
index c9f1851f0..73cd82d42 100644
--- a/tests/old/test_core_functionality.py
+++ b/tests/old/test_core_functionality.py
@@ -79,7 +79,7 @@ class TestCoreFunctionality:
def llm(self):
"""Initialize language model for testing with minimal settings."""
return ChatOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
temperature=0.0,
)
diff --git a/tests/old/test_dropdown_error.py b/tests/old/test_dropdown_error.py
index dedb723dd..94bbe507d 100644
--- a/tests/old/test_dropdown_error.py
+++ b/tests/old/test_dropdown_error.py
@@ -14,7 +14,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from browser_use import Agent, AgentHistoryList
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
browser_session = BrowserSession(browser_profile=BrowserProfile(headless=True))
agent = Agent(
diff --git a/tests/old/test_gif_path.py b/tests/old/test_gif_path.py
index 31bb0dd24..445ab44ba 100644
--- a/tests/old/test_gif_path.py
+++ b/tests/old/test_gif_path.py
@@ -14,7 +14,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from browser_use import Agent, AgentHistoryList
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
browser_session = BrowserSession(browser_profile=BrowserProfile(headless=True, disable_security=True))
diff --git a/tests/old/test_mind2web.py b/tests/old/test_mind2web.py
index 9156818d4..f0f6c6ee0 100644
--- a/tests/old/test_mind2web.py
+++ b/tests/old/test_mind2web.py
@@ -50,7 +50,7 @@ def llm():
# return ChatAnthropic(model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None)
return ChatAzureOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
)
diff --git a/tests/old/test_react_dropdown.py b/tests/old/test_react_dropdown.py
index f15287f6b..f3709253f 100644
--- a/tests/old/test_react_dropdown.py
+++ b/tests/old/test_react_dropdown.py
@@ -15,7 +15,7 @@ import asyncio
from browser_use import Agent, AgentHistoryList
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
browser_session = BrowserSession(browser_profile=BrowserProfile(headless=True, disable_security=True))
diff --git a/tests/old/test_self_registered_actions.py b/tests/old/test_self_registered_actions.py
index 87c467064..c24cfd45a 100644
--- a/tests/old/test_self_registered_actions.py
+++ b/tests/old/test_self_registered_actions.py
@@ -78,7 +78,7 @@ def llm():
# return ChatAnthropic(model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None)
return ChatAzureOpenAI(
- model='gpt-4o',
+ model='gpt-4.1',
)
diff --git a/tests/old/test_vision.py b/tests/old/test_vision.py
index 600e0af17..346b78301 100644
--- a/tests/old/test_vision.py
+++ b/tests/old/test_vision.py
@@ -16,7 +16,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from browser_use import Agent, AgentHistoryList, BrowserSession, Controller
from browser_use.llm import ChatOpenAI
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
controller = Controller()
# use this test to ask the model questions about the page like
diff --git a/tests/old/test_wait_for_element.py b/tests/old/test_wait_for_element.py
index 2e8d55e26..f573e81d8 100644
--- a/tests/old/test_wait_for_element.py
+++ b/tests/old/test_wait_for_element.py
@@ -21,7 +21,7 @@ from browser_use.browser import BrowserProfile, BrowserSession
load_dotenv()
# Initialize language model and controller.
-llm = ChatOpenAI(model='gpt-4o')
+llm = ChatOpenAI(model='gpt-4.1')
controller = Controller()