SDKs

The official clients are deliberately thin: typed wrappers over the four session endpoints with zero runtime dependencies. Your browser automation still runs through Playwright or Puppeteer; the SDK only handles session lifecycle.

Node.js

terminal
npm install browsergen-sdk
example.ts
import { BrowserGen } from "browsergen-sdk";
import { chromium } from "playwright";

const browsergen = new BrowserGen({ apiKey: process.env.BROWSERGEN_KEY! });

const session = await browsergen.sessions.create({ timeout: 900, country: "us" });
const browser = await chromium.connectOverCDP(session.connectUrl);

// ... drive the browser ...

await browser.close();
await browsergen.sessions.stop(session.id);

The package ships ESM and CJS builds with TypeScript types included. Surface: sessions.create({timeout, country, proxy, url}), sessions.list(), sessions.get(id), and sessions.stop(id), plus usage().

Python

terminal
pip install browsergen
example.py
import os
from browsergen import BrowserGen
from playwright.sync_api import sync_playwright

browsergen = BrowserGen(api_key=os.environ["BROWSERGEN_KEY"])

session = browsergen.sessions.create(timeout=900, country="us")

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp(session.connect_url)
    page = browser.contexts[0].pages[0]
    page.goto("https://example.com")
    browser.close()

browsergen.sessions.stop(session.id)

Standard library only (Python 3.9+). The surface mirrors the Node client with snake_case fields: session.connect_url, sessions.stop(id), and so on.

No SDK required. Both packages are conveniences. The REST API is four endpoints; a plain fetch or requests call works everywhere the SDKs do.

Related