jakobhoeg/browser-ai

TypeScript SDK for different in-browser AI model providers, built to make client-side AI integration simpler and more consistent across vendors.

196

stars

525

commits

TypeScript

primary language

Sep 8, 2026

updated

browser-ai.dev
ai
ai-sdk
browser
browser-ai
built-in-ai
chrome-ai
edge
inference
llm
transformer-models
transformers
transformers-js
vercel
webllm

README

Browser AI model providers for Vercel AI SDK

NPM Downloads NPM Downloads NPM Downloads

TypeScript libraries that provide access to in-browser AI model providers with seamless fallback to using server-side models.

Documentation

For detailed documentation, browser requirements and advanced usage, refer to the official documentation site.

Package Versions

PackageAI SDK v5AI SDK v6AI SDK v7
@browser-ai/core1.0.02.x≥ 3.0.0
@browser-ai/transformers-js1.0.02.x≥ 3.0.0
@browser-ai/web-llm1.0.02.x≥ 3.0.0
# For Chrome/Edge built-in browser AI models
npm i @browser-ai/core

# For open-source models via WebLLM
npm i @browser-ai/web-llm

# For 🤗 Transformers.js models
npm i @browser-ai/transformers-js

Basic Usage with Chrome/Edge AI

import { streamText } from "ai";
import { browserAI } from "@browser-ai/core";

const result = streamText({
  model: browserAI(),
  prompt: "Invent a new holiday and describe its traditions.",
});

for await (const chunk of result.textStream) {
  console.log(chunk);
}

Basic Usage with WebLLM

import { streamText } from "ai";
import { webLLM } from "@browser-ai/web-llm";

const result = streamText({
  model: webLLM("Llama-3.2-3B-Instruct-q4f16_1-MLC"),
  prompt: "Invent a new holiday and describe its traditions.",
});

for await (const chunk of result.textStream) {
  console.log(chunk);
}

Basic Usage with Transformers.js

import { streamText } from "ai";
import { transformersJS } from "@browser-ai/transformers-js";

const result = streamText({
  model: transformersJS("HuggingFaceTB/SmolLM2-360M-Instruct"),
  prompt: "Invent a new holiday and describe its traditions.",
});

for await (const chunk of result.textStream) {
  console.log(chunk);
}

Resources

Articles & guides

Example applications

Sponsors

This project is part of the Vercel OSS Program, and was previously sponsored by Chrome for Developers.

Contributing

Contributions are more than welcome! However, please make sure to check out the contribution guidelines before contributing.

Why?

If you've ever built apps with local language models, you're likely familiar with the challenges: creating custom hooks, UI components and state management (lots of it), while also building complex integration layers to fall back to server-side models when compatibility is an issue.

Read more about this here.

Author

2025 © Jakob Hoeg Mørk

Contributors

jakobhoeg

413 commits

mikechao

25 commits

MiguelsPizza

7 commits

jakobhoeg/browser-ai

TypeScript SDK for different in-browser AI model providers, built to make client-side AI integration simpler and more consistent across vendors.

196

stars

525

commits

TypeScript

primary language

Sep 8, 2026

updated

browser-ai.dev
ai
ai-sdk
browser
browser-ai
built-in-ai
chrome-ai
edge
inference
llm
transformer-models
transformers
transformers-js
vercel
webllm

README

Browser AI model providers for Vercel AI SDK

NPM Downloads NPM Downloads NPM Downloads

TypeScript libraries that provide access to in-browser AI model providers with seamless fallback to using server-side models.

Documentation

For detailed documentation, browser requirements and advanced usage, refer to the official documentation site.

Package Versions

PackageAI SDK v5AI SDK v6AI SDK v7
@browser-ai/core1.0.02.x≥ 3.0.0
@browser-ai/transformers-js1.0.02.x≥ 3.0.0
@browser-ai/web-llm1.0.02.x≥ 3.0.0
# For Chrome/Edge built-in browser AI models
npm i @browser-ai/core

# For open-source models via WebLLM
npm i @browser-ai/web-llm

# For 🤗 Transformers.js models
npm i @browser-ai/transformers-js

Basic Usage with Chrome/Edge AI

import { streamText } from "ai";
import { browserAI } from "@browser-ai/core";

const result = streamText({
  model: browserAI(),
  prompt: "Invent a new holiday and describe its traditions.",
});

for await (const chunk of result.textStream) {
  console.log(chunk);
}

Basic Usage with WebLLM

import { streamText } from "ai";
import { webLLM } from "@browser-ai/web-llm";

const result = streamText({
  model: webLLM("Llama-3.2-3B-Instruct-q4f16_1-MLC"),
  prompt: "Invent a new holiday and describe its traditions.",
});

for await (const chunk of result.textStream) {
  console.log(chunk);
}

Basic Usage with Transformers.js

import { streamText } from "ai";
import { transformersJS } from "@browser-ai/transformers-js";

const result = streamText({
  model: transformersJS("HuggingFaceTB/SmolLM2-360M-Instruct"),
  prompt: "Invent a new holiday and describe its traditions.",
});

for await (const chunk of result.textStream) {
  console.log(chunk);
}

Resources

Articles & guides

Example applications

Sponsors

This project is part of the Vercel OSS Program, and was previously sponsored by Chrome for Developers.

Contributing

Contributions are more than welcome! However, please make sure to check out the contribution guidelines before contributing.

Why?

If you've ever built apps with local language models, you're likely familiar with the challenges: creating custom hooks, UI components and state management (lots of it), while also building complex integration layers to fall back to server-side models when compatibility is an issue.

Read more about this here.

Author

2025 © Jakob Hoeg Mørk

Contributors

jakobhoeg

413 commits

mikechao

25 commits

MiguelsPizza

7 commits

Languages

TypeScript

100.0%