jakobhoeg/browser-ai
Sobre
In-browser AI model providers for the Vercel AI SDK, built to make client-side AI integration simpler and more consistent across vendors.
IA e aprendizado de máquinaCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- +2
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalBrowser AI model providers for Vercel AI SDK
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
| Package | AI SDK v5 | AI SDK v6 | AI SDK v7 |
|---|---|---|---|
@browser-ai/core |
✓ 1.0.0 |
✓ 2.x |
✓ ≥ 3.0.0 |
@browser-ai/transformers-js |
✓ 1.0.0 |
✓ 2.x |
✓ ≥ 3.0.0 |
@browser-ai/web-llm |
✓ 1.0.0 |
✓ 2.x |
✓ ≥ 3.0.0 |
@browser-ai/wllama |
- | - | ✓ ≥ 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
# For GGUF models via wllama (llama.cpp)
npm i @browser-ai/wllama
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);
}
Basic Usage with wllama (llama.cpp)
import { streamText } from "ai";
import { wllama } from "@browser-ai/wllama";
const result = streamText({
model: wllama("hf:ggml-org/Qwen3-0.6B-GGUF/Qwen3-0.6B-Q8_0.gguf"),
prompt: "Invent a new holiday and describe its traditions.",
});
for await (const chunk of result.textStream) {
console.log(chunk);
}
Resources
Articles & guides
- Chrome for Developers: Use the Prompt API with the Vercel AI SDK
- Chrome for Developers: Use the Vercel AI SDK UI and AI Elements with the Prompt API
- Hugging Face: Building a Next.js application with the AI SDK
- Hugging Face: Transformers.js × Vercel AI SDK integration
Example applications
- Huggingface Transformers.js AI SDK v5: next-vercel-ai-sdk-v5-transformers-js-example
- Huggingface Transformers.js AI SDK v6: next-vercel-ai-sdk-v6-transformers-js-example
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
Explore projetos relacionados
Carregando…