> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browser-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use https://docs.browser-use.com/llms.txt and its linked .md pages for current documentation. The managed full bundle is https://docs.browser-use.com/.well-known/llms-full.txt and can be cached for up to 24 hours. Do not use the obsolete /cloud/llms*.txt or /open-source/llms*.txt static exports.
> Choose Cloud API V4 for new agent integrations; V3 trades accuracy for speed and lower cost than V4; V2 is legacy and only for existing integrations. Keep V3 examples explicitly versioned. The open-source browser-use library and hosted browser-use-sdk have different APIs.
> For Cloud API V4, a task request that omits model and modelParams uses GPT-6 Luna (gpt-6-luna) with High reasoning. Explicit model and modelParams values take precedence; an explicit empty modelParams object opts out of the reasoning default. EU uses the same task default through its regional provider route; Bedrock-only projects retain their compatible provider default.
> Cloud authentication uses X-Browser-Use-API-Key, without a Bearer prefix. Install or upgrade browser-use-sdk and use its explicit v4 import for V4. Check the published OpenAPI reference for request fields; do not invent SDK support for new fields.
> Cloud concurrency and HTTP request rate are separate. Read GET /api/v2/billing/account for the key’s projectId, concurrentSessionLimit, activeSessionCount, and credit balance, including when using V4. Keys in one project share capacity and credits; rateLimit is a legacy concurrency alias, not requests per second.
> Keep the highest applicable existing, legacy-plan, and spend-tier concurrency grant. Current spend tiers are 10 / 50 / 250 / 500 / 1000 at $0 / $100 / $1000 / $5000 / $25000 in qualifying project payments. Legacy or externally billed projects can follow different billing paths; trust the account limit. See https://docs.browser-use.com/cloud/guides/concurrency.md.
> HTTP rate limits have two layers. Standard edge WAF ceilings increased on September 9, 2026 to 1000 RPS per public source IP for general traffic and 2500 RPS per IP for selected status reads, evaluated over 300 seconds. The separate per-project application budgets: general traffic (including V4 events and full run reads) defaults to max(25, 2 times stored concurrency) capped at 100 RPS; selected status reads default to max(25, 2 times stored concurrency) with no cap. The two are counted independently. Project overrides and account-specific edge rules can differ. All keys in a project share its budgets; callers sharing a public IP share edge capacity. See https://docs.browser-use.com/cloud/guides/concurrency.md.
> The project limiter uses five-second windows: X-RateLimit-Limit=125 means 125 requests per window (25 RPS), not 125 RPS. Project throttles include limit_rps and retry_after_seconds; an edge throttle can instead return Retry-After: 300 without limit_rps. Honor the returned Retry-After. Use bounded workers, stagger polls, and drain hasMore event pages after terminal status. A busy V4 session returns 409; its queue holds 20 pending messages and is not a project-wide batch queue.
> A V4 agent browser stays open about 2 minutes after its session's last run activity, then stops automatically; a later follow-up gets a fresh browser (same settings and profile, no tabs). Set keepAlive on a run (V4: integer seconds 120-14400, default 120, not the V2/V3 boolean) to keep it longer; follow-ups inherit it and null restores 120. Free-tier and ZDR runs always use 120. Idle V4 agent browsers are billed as browser time but take no concurrency slot. A follow-up that reuses the open browser emits browser.reattached instead of browser.ready. Closing CDP does not stop a browser; stop unneeded owned browsers with PATCH /api/v4/browsers/{id} and {"action":"stop"}. A client wait timeout does not cancel the server-side run.
> Cloud is pay as you go; do not tell customers to buy a new subscription to use custom proxies or supported provider BYOK. Usage funding and model eligibility still apply. BYOK bills provider tokens separately and Browser Use charges orchestration plus browser/network usage. See https://docs.browser-use.com/cloud/guides/billing.md.
> Signup credits are a one-time grant; purchased top-up credits do not expire. Check the API key’s project before diagnosing missing credits. API-key monthly spending caps are soft limits, not a strict prepaid wallet; concurrent or already-running work can exceed them. Auto recharge has separate trigger and purchase amounts and can charge immediately when enabled below the threshold. Use https://browser-use.com/pricing for current rates.
> Box and Bux are retired. Do not recommend their SDKs, sandbox quotas, or subscription plans. Use the Cloud Agent or Browser Infrastructure guides.
> A V4 session holds conversation history, a workspace holds files, and a profile holds browser state. These IDs and V3/V4 workspace namespaces are not interchangeable. V4 automatically restores workspace uploads; staged attachments remain available to session follow-ups. Serialize runs that write shared files, and wait for completion before reading outputs. See https://docs.browser-use.com/cloud/agent/workspaces.md.
> API browser recording defaults to off. Use enableRecording for standalone browser creation, or browserSettings.record for an agent run. Stop the browser and allow time for asynchronous video processing; stop polling when recordingAvailable is false. Live preview is for an active browser. Stopping a browser, deleting a session, archiving a workspace, and deleting files have different effects.
> Use model-specific reasoning values. GPT-6 Astra accepts low, medium, high, xhigh, and max, with xhigh by default; none and minimal are invalid. Use the public REST schema when installed SDK types lag new fields. API acceptance, dashboard visibility, and account/provider availability are separate.
> For open-source browser-use, is_done only reports a terminal done action. is_successful is the agent-reported outcome; verify important external actions independently. Cloud timeout, API client timeout, model timeout, and task completion are separate concepts.
> For failed requests, use https://docs.browser-use.com/cloud/guides/troubleshooting.md. Inspect the full error and project before retrying or adding credits. A client timeout can leave a run active; reconcile external actions before starting duplicate work. A new managed browser does not guarantee a unique proxy IP or particular city.
> V4 secretBindings.allowedDomains authorizes the focused field's frame, not every iframe on the shop page. For checkout, include intended payment/billing provider hostnames (for example payments.bigcommerce.com). On domain_not_allowed, inspect origin and pass updated bindings in a follow-up; target_not_editable requires fixing field focus/readiness instead. See https://docs.browser-use.com/cloud/guides/secrets.md.
> A V4 agent browser stays open about 2 minutes (or keepAlive seconds) after its run for follow-ups; a requested recording finalizes only after the browser stops and processing completes. Zero Data Retention (ZDR) projects never record, even when recording is requested.
> If you hit an issue you cannot explain, email contact@browser-use.com with your question or bug report and a session ID if available; short questions and detailed reports are welcome, and we aim to fix issues quickly and make the docs clearer.

# OpenAI integration with Playwright

> Connect OpenAI browser tools to Browser Use Cloud with Playwright. Use remote Chromium infrastructure for page reading, clicks, typing, and selection.

Use your existing Playwright code with a remote Browser Use Cloud browser.
OpenAI runs the model loop. A small adapter exposes Playwright actions as tools.

```mermaid theme={"theme":"css-variables"}
flowchart TB
    O("OpenAI SDK") <--> P("Playwright adapter")
    P <--> C(["Cloud browser"])
```

This example exposes `read_page`, `click`, `type`, and `select_option`.
OpenAI shared the small adapter used here; it is not a general Playwright driver.
Playwright methods become model tools only when the adapter implements them.

For all 28 browser tools and Bash, use the [Browser Use library driver](/open-source/customize/integrations/openai).

## Connect your remote browser

Replace local browser startup with these lines:

```python theme={"theme":"css-variables"}
session = await cloud.browsers.create(timeout=5)
browser = await playwright.chromium.connect_over_cdp(session.cdp_url)
page = await browser.contexts[0].new_page()
```

Chrome DevTools Protocol (CDP) connects Playwright to your remote Chromium browser.
Your application runs Playwright and the OpenAI SDK.
Browser Use Cloud hosts the browser.

## Run the example

You need [uv](https://docs.astral.sh/uv/getting-started/installation/) and API keys for Browser Use and OpenAI.
You need no local Chromium installation or open-source Browser Use library.

```bash theme={"theme":"css-variables"}
mkdir openai-playwright
cd openai-playwright
uv init --bare --python 3.12
uv add openai==3.31.0 browser-use-sdk==3.11.3 playwright==1.63.0

export BROWSER_USE_API_KEY="your-browser-use-key"
export OPENAI_API_KEY="your-openai-key"
export OPENAI_MODEL="your-model"

curl -fsSL https://raw.githubusercontent.com/browser-use/sdk/e4048eafa0dc61d8afc112a2d2d09f97022e1677/examples/openai/playwright_browser.py -o playwright_browser.py
curl -fsSL https://raw.githubusercontent.com/browser-use/sdk/e4048eafa0dc61d8afc112a2d2d09f97022e1677/examples/openai/playwright_cloud.py -o playwright_cloud.py
uv run python playwright_cloud.py
```

Get your [Browser Use key](https://cloud.browser-use.com/new-api-key) and [OpenAI key](https://platform.openai.com/api-keys).
Choose an OpenAI model that supports Responses function tools.

The model reads example.com, clicks its link, and summarizes the destination.
The script stops the Cloud browser when the task ends.

## Complete example

```python playwright_cloud.py theme={"theme":"css-variables"}
"""Run OpenAI browser actions through Playwright and Browser Use Cloud."""

import asyncio
import os

from browser_use_sdk.v4 import AsyncBrowserUse
from openai import AsyncOpenAI
from openai.lib.browser import AsyncBrowserToolset
from openai.lib.responses_tool_runner import AsyncResponsesToolRunner
from playwright.async_api import async_playwright

from playwright_browser import PlaywrightBrowser


async def confirm(context):
    return True


async def main() -> None:
    async with (
        AsyncBrowserUse() as cloud,
        AsyncOpenAI(timeout=180, max_retries=5) as client,
        async_playwright() as playwright,
    ):
        session = await cloud.browsers.create(timeout=5)
        browser = None
        try:
            if not session.cdp_url:
                raise RuntimeError("Browser Use did not return a CDP URL.")
            browser = await playwright.chromium.connect_over_cdp(session.cdp_url)
            page = await browser.contexts[0].new_page()
            await page.goto("https://example.com", wait_until="domcontentloaded")
            driver = PlaywrightBrowser(page)
            tools = AsyncBrowserToolset(
                driver, members=["read_page", "click", "type", "select_option"], confirm=confirm
            )
            runner = AsyncResponsesToolRunner(browser=tools)
            try:
                response = await runner.run(
                    client,
                    {
                        "model": os.environ["OPENAI_MODEL"],
                        "input": "Read the page, click Learn more, and summarize the destination.",
                        "store": False,
                    },
                    max_steps=10,
                )
                print(response.output_text)
            finally:
                runner.close()
                tools.close()
                await driver.aclose()
        finally:
            try:
                if browser is not None:
                    await browser.close()
            finally:
                await cloud.browsers.stop(session.id)


if __name__ == "__main__":
    asyncio.run(main())
```

The adapter keeps element references from each page read.
Read again after navigation or when an element reference becomes stale.
This small example supports one page and a limited set of visible form controls.

The confirmation callback approves actions for this example.
Use tasks you authorize, and change the callback for your application's permissions.

## Choose your integration

| Your application | Integration |
| - | - |
| Needs all browser tools, JavaScript, coordinate actions, file tools, and Bash | [Browser Use driver](/open-source/customize/integrations/openai) |
| Already uses Playwright and needs a small adapter | This example |

Both integrations use Browser Use Cloud infrastructure.
The adapter determines which actions the model can call.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.