How to integrate Chrome Built-in AI with Vercel AI SDK using @browser-ai/core

The @browser-ai/core library, maintained by Jakob Hoeg Mørk under the Vercel OSS Program since 2025, connects Chrome's built-in AI to the Vercel AI SDK across three local inference engines: Prompt API, Transformers.js, and WebLLM. Developers can run local large language models in the browser in roughly 30 lines of code using browserAI() with generateText or streamText, without any API keys or cloud hosting costs. The library handles edge cases such as unsupported browsers and mid-download model states, offering progress tracking via createSessionWithProgress to improve user experience during multi-gigabyte model downloads. The next-hybrid example template demonstrates advanced patterns including a custom ChatTransport for client-side chat, tool-calling with user approval dialogs, and seamless switching between local and cloud models. A real-world reference implementation, domainstack.io, further illustrates an auto-fallback architecture where the local model silently switches to a cloud API when hardware or browser support is unavailable.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in