![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@browserbasehq/sdk
Advanced tools
Browserbase is the best developer platform to reliably run, manage, and monitor headless browsers.
Get browsers' full control and leverage Browserbase's Infrastructure, Stealth Mode, and Session Debugger to power your automation, test suites, and LLM data retrievals.
npm install -S @browserbasehq/sdk
import { Browserbase } from '@browserbasehq/sdk'
// Init the SDK
const browserbase = new Browserbase()
// Load a webpage
const rawHtml = await browserbase.load('https://www.browserbase.com')
// Load multiple webpages (returns iterator)
const rawHtmls = browserbase.loadURLs([
'https://www.browserbase.com',
'https://docs.browserbase.com',
])
for await (let rawHtml of rawHtmls) {
// ...
}
// Text-only mode
const text = await browserbase.load('https://www.browserbase.com', {
textContent: true,
})
// Screenshot (returns bytes)
const result = await browserbase.screenshot('https://www.browserbase.com', {
textContent: true,
})
Install the additional dependencies:
npm i ai openai zod
import OpenAI from 'openai'
import { Browserbase } from '@browserbasehq/sdk'
import { BrowserbaseAISDK } from '@browserbasehq/sdk/dist/integrations/ai-sdk'
import {
OpenAIStream,
StreamingTextResponse,
experimental_generateText,
} from 'ai'
// Create new OpenAI client
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
})
// Init the Browserbase SDK
const browserbase = new Browserbase()
// Init the tool
const browserTool = BrowserbaseAISDK(browserbase, { textContent: true })
// Load completions
const result = await experimental_generateText({
model: openai.chat('gpt-3.5-turbo'),
tools: {
browserTool,
},
prompt: 'What is the weather in San Francisco?',
})
FAQs
The official Node.js library for the Browserbase API
We found that @browserbasehq/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.