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

chrome-ai-tools

v0.2.1

Published

Call Chrome's built-in AI APIs (Gemini Nano) from Node.js

Readme

Chrome AI Bridge

Call Chrome's built-in AI APIs (Gemini Nano) from Node.js or Python.

Chrome's AI APIs only run inside browser pages. chrome-ai bridges that gap: a Python HTTP server manages a prompt queue, and a bridge page (open once in Chrome) processes prompts by calling the API directly.

Status: Alpha. Not yet published to npm. APIs may change, edge cases remain. Works for prototyping via local install.

Install

npm install chrome-ai-tools

Then use the chrome-ai CLI directly:

npx chrome-ai prompt "hello"
# or install globally
npm install -g chrome-ai-tools
chrome-ai summarize "some text"

Just Chrome. No agent-browser, no extensions, no API keys.

Quick Start

Start the server:

python3 server.py
# → http://localhost:8462

Open that URL in Chrome. Keep the tab open.

Now use the CLI:

npx chrome-ai prompt "What is the capital of France?"
npx chrome-ai summarize "Some long text here..."
npx chrome-ai translate --from en --to fr "Hello"
npx chrome-ai write "Write a poem about cats"
# or pipe text in
cat some-file.txt | npx chrome-ai summarize

Or from Node.js:

import { prompt, summarize, translate, write } from 'chrome-ai-tools';

const answer = await prompt({
  system: 'You are helpful.',
  user: 'What is the capital of France?',
});
const summary = await summarize('Long text...');
const french = await translate('Hello', 'en', 'fr');
const poem = await write('Write a haiku about dogs');

Or from Python:

from client import prompt, summarize, translate, write

answer = prompt('You are helpful.', 'What is the capital of France?')
summary = summarize('Long text...')
french = translate('Hello', 'en', 'fr')
poem = write('Write a haiku about dogs')

Or from any HTTP client:

# Prompt API
curl -s -X POST http://localhost:8462/prompt \
  -H 'Content-Type: application/json' \
  -d '{"api":"prompt","system":"You are helpful.","user":"Hello!"}'

# Summarizer API
curl -s -X POST http://localhost:8462/prompt \
  -H 'Content-Type: application/json' \
  -d '{"api":"summarize","text":"Long text to summarize..."}'

# Translator API
curl -s -X POST http://localhost:8462/prompt \
  -H 'Content-Type: application/json' \
  -d '{"api":"translate","text":"Hello","sourceLanguage":"en","targetLanguage":"fr"}'

# Writer API
curl -s -X POST http://localhost:8462/prompt \
  -H 'Content-Type: application/json' \
  -d '{"api":"write","text":"Write a haiku","context":"dogs"}'

# Poll for result
curl -s http://localhost:8462/result/a1b2c3d4e5f6
# → {"status": "done", "text": "..."}

How it works

Client (Node / Python / curl / CLI)
    │
    ├─ POST /prompt {api, ...params} → {id}
    │
    ▼
Python HTTP server — manages prompt queue
    │
    ├─ GET /pending ← bridge page polls every 500ms
    │
    ▼
Bridge page (Chrome, open once)
    - dispatches to LanguageModel / Summarizer / Translator / Writer
    - POSTs result to /result/{id}
    │
    ▼
Client — poll GET /result/{id} → result

API

TypeScript

import { prompt, summarize, translate, write } from 'chrome-ai-tools';

// Prompt API
const text = await prompt({
  system?: string,  // system prompt (optional)
  user: string,     // user message (required)
});

// Summarizer API
const summary = await summarize(text: string);

// Translator API
const translated = await translate(
  text: string,
  sourceLanguage: string,
  targetLanguage: string,
);

// Writer API
const written = await write(text: string, context?: string);

Python

from client import prompt, summarize, translate, write

text = prompt(system: str, user: str, timeout: float = 120)

summary = summarize(text: str, timeout: float = 120)

translated = translate(
    text: str,
    source_language: str,
    target_language: str,
    timeout: float = 120,
)

written = write(text: str, context: str = "", timeout: float = 120)

CLI

chrome-ai prompt "What is the capital of France?"

chrome-ai summarize "Some text to summarize..."

chrome-ai translate --from en --to fr "Hello world"

chrome-ai write "Write a poem" --context "cats"

# Pipe text in
cat file.txt | chrome-ai summarize
cat file.txt | chrome-ai translate --from en --to es

Auto-starts the Python server if not already running.

Server Endpoints

| Method | Path | Purpose | |--------|------|---------| | POST | /prompt | Submit a job {api, ...params}{id} | | GET | /pending | Bridge page polls for pending jobs | | POST | /result/{id} | Bridge page submits result {status, text} | | GET | /result/{id} | Client polls for result | | GET | /health | {ok, port, pending} |

POST /prompt params

| api | Required params | Optional params | |-----|----------------|-----------------| | prompt | user | system | | summarize | text | — | | translate | text, sourceLanguage, targetLanguage | — | | write | text | context |

Requirements

  • Recent desktop Chrome (v129+, Prompt API on by default)
  • Python 3.9+

Also a Pi Skill

SKILL.md — installable via skills.sh install donpark/chrome-ai for use with Pi coding agent.