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

@tablefolk/brain

v0.1.1

Published

A language model in the browser with one call: picks Gemma 4 (WebGPU), a tiny Qwen, Chrome's built-in model or an OpenAI-compatible server (OpenRouter sign-in included) for this device; chat, stream, pick, yes/no, JSON and a Prompt-API-shaped session.

Readme

@tablefolk/brain

A language model in the browser with one call. It picks what this device can run, downloads and caches it, and gives you plain methods:

  • Gemma 4 E2B/E4B on WebGPU (LiteRT-LM, in a worker, cached in OPFS);
  • Bonsai 2 27B for 10 GB+ cards;
  • a tiny Qwen where there is no GPU;
  • Chrome's built-in model;
  • any OpenAI-compatible server.
import { createBrain } from '@tablefolk/brain';

const brain = await createBrain({ onStatus: s => console.log(s) });
brain.why                                        // "Gemma 4 E2B: 8 GB usable, 210 GB/s"
await brain.chat('Say hi as a blacksmith')
for await (const piece of brain.stream('Tell a short story')) el.textContent += piece;
await brain.pick('Which fits "mend my blade"?', ['buy', 'repair', 'leave'])   // { index: 1, choice: 'repair', by: 'model' }
await brain.yesno('The player is angry.', { context: 'Player: "Give it back NOW!"' })   // 1 or 0 (a probability with a decider)
await brain.json('Invent a tavern keeper', { example: { name: 'Mara', age: 40 } })      // { name, age }

// Chrome's Prompt API shape, on whatever runs here
const s = await brain.languageModel.create({ initialPrompts: [{ role: 'system', content: 'Be brief.' }] });
await s.prompt('Hello'); s.promptStreaming('More');

Options:

| option | what it does | |---|---| | model | 'auto', 'gemma4-e2b', 'gemma4-e4b', 'bonsai2-27b', 'qwen1.5-0.5b', 'chrome' or 'endpoint' | | endpoint | { baseURL, apiKey, model } | | fallback | the order tried when loading fails: ['chrome', 'endpoint', 'qwen1.5-0.5b'] by default | | ask | async model => true: approve a download | | engine | your own { generate(messages, opts), unload() } | | decider | a @tablefolk/decider: pick and yesno get calibrated probabilities |

Visitors can use their own OpenRouter account (OAuth PKCE, no server needed):

import { signIn, finishSignIn, openRouterEndpoint } from '@tablefolk/brain/openrouter.js';
signInButton.onclick = () => signIn();
const key = await finishSignIn();   // on the way back (?code=...)
if (key) brain = await createBrain({ model: 'endpoint', endpoint: openRouterEndpoint(key) });

The models download from Hugging Face (Tablefolk's mirror on tablefolk.world). Each model's own licence applies: Gemma 4 and Bonsai 2 are Apache-2.0; the tiny fallback, Qwen1.5 0.5B, is under the Tongyi Qianwen research licence (not for commercial use: pass fallback without 'qwen1.5-0.5b').

Part of Tablefolk (libs/). MIT.