SDKs & reference

SDKs

Typed Node.js and Python clients wrap the same API documented here. Both are thin, zero-dependency clients with a two-tier design: a low-level `launch` plus a high-level `connect` that hands you a ready Playwright browser.

Install

npm i @oculr/sdk
# optional, for connect():
npm i playwright
The SDKs ship with Oculr and are publishing to npm and PyPI. The API below is stable; only registry availability is rolling out.

TypeScript

import { OculrClient } from "@oculr/sdk";
const oculr = new OculrClient({
baseUrl: "http://127.0.0.1:8378",
token: process.env.OCULR_TOKEN,
});
// Low-level: launch and get a ready CDP endpoint + recipes.
const res = await oculr.launch("de-store-01", { stealth: "balanced" });
console.log(res.ws_endpoint);
// High-level: launch and connect a Playwright browser in one call.
const { browser } = await oculr.connect("de-store-01", { stealth: "max" });
const page = browser.contexts()[0].pages()[0];
await page.goto("https://example.com");

Python

import os
from oculr import OculrClient
from playwright.sync_api import sync_playwright
oculr = OculrClient("http://127.0.0.1:8378", token=os.environ["OCULR_TOKEN"])
# Low-level: launch and read the endpoint.
res = oculr.launch("de-store-01", stealth="balanced")
print(res["ws_endpoint"])
# High-level: launch and connect a Playwright browser.
with sync_playwright() as p:
browser, _ = oculr.connect_playwright(p, "de-store-01", stealth="max")
page = browser.contexts[0].pages[0]
page.goto("https://example.com")