browseraiOpen the playground

Sessions and CDP

A session is one Chromium process with its own profile held in memory. You get a WebSocket URL that speaks the Chrome DevTools Protocol.

Open

const s = await bai.open({
  timeout: 600,        // hard limit in seconds, 30 to 3600 (default 600)
  idleTimeout: 120,    // close after this long with no client connected, 15 to 600
  liveView: false,     // stream the screen to a live view URL
  replay: false,       // keep frames for one hour after close
  viewport: { width: 1280, height: 800 },
})

The response carries connectUrl (with a session token), actionsUrl, and liveViewUrl or replayUrl when you asked for them.

Connect

// Playwright
const browser = await chromium.connectOverCDP(s.connectUrl)

// Puppeteer
const browser = await puppeteer.connect({ browserWSEndpoint: s.connectUrl })

Any client that speaks CDP works: the URL proxies the browser endpoint, and /v1/sessions/:id/devtools/page/:targetId proxies page targets. Several clients can be connected at once.

Close

Call s.close(). The session also closes when its timeout is reached, after idleTimeout seconds with no client connected and no action, or when the balance runs out. In every case the Chromium process group is killed and its profile directory is deleted.

Network rules

Every request the browser makes goes through an egress filter that resolves the host and refuses loopback, private, link-local and internal ranges, then connects to the address it checked. Creating a browser context with its own proxy is refused. The public web is reachable as usual.

Capacity

Each machine runs up to three paid sessions at a time. When they are all busy, open answers 503 with a message; retry a few seconds later.