Skip to main content

Option 1: WebSocket URL (no SDK)

Connect with a single URL. All configuration is passed as query parameters.

Playwright

from playwright.async_api import async_playwright

WSS_URL = "wss://connect.browser-use.com?apiKey=YOUR_API_KEY&proxyCountryCode=us"

async with async_playwright() as p:
    browser = await p.chromium.connect_over_cdp(WSS_URL)
    page = browser.contexts[0].pages[0]
    await page.goto("https://example.com")
    print(await page.title())
    await browser.close()
# Browser is automatically stopped when the WebSocket disconnects

Puppeteer

import puppeteer from "puppeteer-core";

const WSS_URL = "wss://connect.browser-use.com?apiKey=YOUR_API_KEY&proxyCountryCode=us";

const browser = await puppeteer.connect({ browserWSEndpoint: WSS_URL });
const [page] = await browser.pages();
await page.goto("https://example.com");
console.log(await page.title());
await browser.close();

Selenium

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from browser_use_sdk.v3 import AsyncBrowserUse

client = AsyncBrowserUse()
browser = await client.browsers.create()

options = Options()
options.debugger_address = browser.cdp_url.replace("ws://", "").replace("/devtools/browser/", "")
driver = webdriver.Chrome(options=options)
driver.get("https://example.com")
print(driver.title)
driver.quit()

await client.browsers.stop(browser.id)

Query parameters

ParameterTypeDescription
apiKeystringRequired. Your Browser Use API key.
proxyCountryCodestringProxy country code (e.g. us, de, jp). 195+ countries.
profileIdstringLoad a saved browser profile (cookies, localStorage).
timeoutintSession timeout in minutes. Max: 240 (4 hours).
browserScreenWidthintBrowser width in pixels.
browserScreenHeightintBrowser height in pixels.

Option 2: SDK

Create a browser via the SDK, get a cdp_url, connect with your framework.
from browser_use_sdk.v3 import AsyncBrowserUse

client = AsyncBrowserUse()
browser = await client.browsers.create(proxy_country_code="us")
print(browser.cdp_url)   # ws://...
print(browser.live_url)  # debug view
Always stop browser sessions when done. Sessions left running will continue to incur charges until the timeout expires.