npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@browserless/ai

v13.13.1

Published

Run Chrome Built-in AI APIs (Prompt, Summarizer, Translator, Language Detector) from Node.js using browserless.

Readme

@browserless/ai: Run Chrome Built-in AI from Node.js.

See the ai section on our website for more information.

Install

Using npm:

npm install @browserless/ai --save

Requires Node.js 24+ and a browserless peer.

About

This package runs Chrome Built-in AI from Node.js. It evaluates Prompt, Summarizer, Translator, and Language Detector on a browserless page, so you can call those APIs from a script instead of a visible Chrome window.

Chrome for Testing does not download Gemini Nano for you. Pack a model on a machine that already has it, unpack it into one directory, then pass that dir to createAi / launch.

Chrome’s docs allow the foundation model on GPU (>4 GB VRAM) or CPU (16 GB RAM, 4+ cores) at runtime. The 22 GB profile-volume space and unmetered connection apply only when desktop Chrome first downloads Nano, not when you launch with a packed dir.

Usage

const createAi = require('@browserless/ai')

const { dir } = await createAi.unpack(createAi.download)
const ai = createAi({ dir })

await ai.capabilities()
await ai.detectLanguage('https://example.com', { text: 'Hello, how are you today?' })
await ai.summarize('https://example.com', { type: 'tldr' })
await ai.prompt('https://example.com', { prompt: 'What is this page about?' })
const schema = { type: 'object', properties: { title: { type: 'string' } } }
await ai.extract('https://example.com', { schema })
await ai.translate('https://example.com', { text: 'Hello', sourceLanguage: 'en', targetLanguage: 'es' })
await ai.close()

unpack accepts a local zip path or a download function. createAi.download is a signed R2 GetObject (R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY). The bucket and object key can live in R2_ENDPOINT (https://<account>.r2.cloudflarestorage.com/<bucket>/<key>), or in R2_BUCKET / R2_KEY. The function can return a path, Buffer, stream, or S3 GetObject result, or write to the dest path it receives. If the directory is already unpacked, unpack reuses it unless you pass { force: true }.

If you already have a browserless instance:

const createBrowser = require('browserless')
const createAi = require('@browserless/ai')

const browser = createBrowser(createAi.launch({ dir: process.env.BROWSERLESS_AI_DIR }))
const ai = createAi(async teardown => {
  const browserless = await browser.createContext()
  teardown(() => browserless.destroyContext())
  return browserless
})

Each page-processing method is (url, options). Pass options.text to use your own input; otherwise the package reads document.body.innerText after navigation. capabilities accepts { timeout, url } and supplies defaults.

| Method | Create options | |--------|----------------| | prompt / extract | temperature, topK, initialPrompts, expectedInputs, expectedOutputs | | summarize | type, format, length, sharedContext, expectedInputLanguages, outputLanguage, expectedContextLanguages | | translate | sourceLanguage, targetLanguage (required) | | detectLanguage | expectedInputLanguages |

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | dir | string | BROWSERLESS_AI_DIR | Unpacked model tree (nano/, prompt/, summarize/, detect/) | | timeout | number | 300000 | Launch and evaluate timeout (ms). protocolTimeout follows it |

unpack(source, { dir, force }) writes to dir when you pass one. Otherwise it uses BROWSERLESS_AI_DIR, or ~/.cache/browserless-ai.

Pack a model

From a machine that already has Nano (desktop Chrome, or BROWSERLESS_AI_DIR):

pnpm --filter @browserless/ai pack-model
pnpm --filter @browserless/ai pack-model -- --upload

Writes /tmp/browserless-ai-nano.zip. --upload also pushes it to R2 (R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY; bucket/key may be in the endpoint URL). Tests run install-model first and download that object when the same variables are set.

Example

pnpm --filter @browserless/ai start
pnpm --filter @browserless/ai start https://example.com

Methods

| Method | Chrome API | Chrome | |--------|------------|--------| | prompt | LanguageModel | 148 | | extract | LanguageModel + schema / responseConstraint | 148 | | summarize | Summarizer | 138 | | detectLanguage | LanguageDetector | 138 | | translate | Translator | 138 | | capabilities | feature detect | — |

extract requires schema or responseConstraint. translate requires sourceLanguage and targetLanguage. Language Detector and Translator download separately from Gemini Nano. Prompt and Summarizer use Nano.

How it fits in the monorepo

This is an extended functionality package. It is not wired into browserless core — install @browserless/ai when you need Chrome Built-in AI from Node.js.

License

@browserless/ai © Microlink, released under the MIT License. Authored and maintained by Microlink with help from contributors.

The logo has been designed by xinh studio.

microlink.io · GitHub microlinkhq · X @microlinkhq