Run local LLMs like llama, deepseek-distill, kokoro and more inside your browser
1,450
stars
347
commits
TypeScript
primary language
Jul 21, 2026
updated
Simple β’ Fast β’ Private β’ Open Source
Live Demo β’ Documentation β’ Discord Community
π Featured Project: Check out Browseragent.dev - A no-code AI Agent builder powered by BrowserAI with unlimited executions! Build your own AI agents in minutes.
| Demo | Description | Try It |
|---|---|---|
| Chat | Multi-model chat interface | chat.browserai.dev |
| Voice Chat | Full-featured with speech recognition & TTS | voice-demo.browserai.dev |
| Text-to-Speech | Powered by Kokoro 82M | tts-demo.browserai.dev |
npm install @browserai/browserai
OR
yarn add @browserai/browserai
import { BrowserAI } from '@browserai/browserai';
const browserAI = new BrowserAI();
// Load model with progress tracking
await browserAI.loadModel('llama-3.2-1b-instruct', {
quantization: 'q4f16_1',
onProgress: (progress) => console.log('Loading:', progress.progress + '%')
});
// Generate text
const response = await browserAI.generateText('Hello, how are you?');
console.log(response.choices[0].message.content);
const response = await browserAI.generateText('Write a short poem about coding', {
temperature: 0.8,
max_tokens: 100,
system_prompt: "You are a creative poet specialized in technology themes."
});
const ai = new BrowserAI();
await ai.loadModel('gemma-2b-it');
const response = await ai.generateText([
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'What is WebGPU?' }
]);
const response = await browserAI.generateText('List 3 colors', {
json_schema: {
type: "object",
properties: {
colors: {
type: "array",
items: {
type: "object",
properties: {
name: { type: "string" },
hex: { type: "string" }
}
}
}
}
},
response_format: { type: "json_object" }
});
const browserAI = new BrowserAI();
await browserAI.loadModel('whisper-tiny-en');
// Using the built-in recorder
await browserAI.startRecording();
const audioBlob = await browserAI.stopRecording();
const transcription = await browserAI.transcribeAudio(audioBlob, {
return_timestamps: true,
language: 'en'
});
const ai = new BrowserAI();
await ai.loadModel('kokoro-tts');
const audioBuffer = await browserAI.textToSpeech('Hello, how are you today?', {
voice: 'af_bella',
speed: 1.0
});// Play the audio using Web Audio API
const audioContext = new AudioContext();
const source = audioContext.createBufferSource();
audioContext.decodeAudioData(audioBuffer, (buffer) => {
source.buffer = buffer;
source.connect(audioContext.destination);
source.start(0);
});
import { DemucsEngine } from '@browserai/browserai/demucs';
const engine = new DemucsEngine();
await engine.loadModel({ /* htdemucs config */ });
// Separate an AudioBuffer into stems
const result = await engine.separate(audioBuffer, {
shifts: 1, // Time-shift augmentation passes (higher = better quality, slower)
overlap: 0.25, // Segment overlap ratio
});
// result.sources contains: drums, bass, other, vocals (each as AudioBuffer)
const vocals = result.sources['vocals'];
const ai = new BrowserAI();
// Load a GGUF model via the Flare engine
await ai.loadModel('llama-3.2-1b-flare');
// Generate text β same API as MLC/Transformers
const response = await ai.generateText('Explain quantum computing briefly');
// Optional: Load a LoRA adapter
await ai.loadAdapter({ url: 'https://example.com/adapter.safetensors' });
More models will be added soon. Request a model by creating an issue.
We welcome contributions! Feel free to:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ for the AI community
shader-f16 requirement, hardware must support 16-bit floating point operationsTypeScript
98.9%
Run local LLMs like llama, deepseek-distill, kokoro and more inside your browser
1,450
stars
347
commits
TypeScript
primary language
Jul 21, 2026
updated
Simple β’ Fast β’ Private β’ Open Source
Live Demo β’ Documentation β’ Discord Community
π Featured Project: Check out Browseragent.dev - A no-code AI Agent builder powered by BrowserAI with unlimited executions! Build your own AI agents in minutes.
| Demo | Description | Try It |
|---|---|---|
| Chat | Multi-model chat interface | chat.browserai.dev |
| Voice Chat | Full-featured with speech recognition & TTS | voice-demo.browserai.dev |
| Text-to-Speech | Powered by Kokoro 82M | tts-demo.browserai.dev |
npm install @browserai/browserai
OR
yarn add @browserai/browserai
import { BrowserAI } from '@browserai/browserai';
const browserAI = new BrowserAI();
// Load model with progress tracking
await browserAI.loadModel('llama-3.2-1b-instruct', {
quantization: 'q4f16_1',
onProgress: (progress) => console.log('Loading:', progress.progress + '%')
});
// Generate text
const response = await browserAI.generateText('Hello, how are you?');
console.log(response.choices[0].message.content);
const response = await browserAI.generateText('Write a short poem about coding', {
temperature: 0.8,
max_tokens: 100,
system_prompt: "You are a creative poet specialized in technology themes."
});
const ai = new BrowserAI();
await ai.loadModel('gemma-2b-it');
const response = await ai.generateText([
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'What is WebGPU?' }
]);
const response = await browserAI.generateText('List 3 colors', {
json_schema: {
type: "object",
properties: {
colors: {
type: "array",
items: {
type: "object",
properties: {
name: { type: "string" },
hex: { type: "string" }
}
}
}
}
},
response_format: { type: "json_object" }
});
const browserAI = new BrowserAI();
await browserAI.loadModel('whisper-tiny-en');
// Using the built-in recorder
await browserAI.startRecording();
const audioBlob = await browserAI.stopRecording();
const transcription = await browserAI.transcribeAudio(audioBlob, {
return_timestamps: true,
language: 'en'
});
const ai = new BrowserAI();
await ai.loadModel('kokoro-tts');
const audioBuffer = await browserAI.textToSpeech('Hello, how are you today?', {
voice: 'af_bella',
speed: 1.0
});// Play the audio using Web Audio API
const audioContext = new AudioContext();
const source = audioContext.createBufferSource();
audioContext.decodeAudioData(audioBuffer, (buffer) => {
source.buffer = buffer;
source.connect(audioContext.destination);
source.start(0);
});
import { DemucsEngine } from '@browserai/browserai/demucs';
const engine = new DemucsEngine();
await engine.loadModel({ /* htdemucs config */ });
// Separate an AudioBuffer into stems
const result = await engine.separate(audioBuffer, {
shifts: 1, // Time-shift augmentation passes (higher = better quality, slower)
overlap: 0.25, // Segment overlap ratio
});
// result.sources contains: drums, bass, other, vocals (each as AudioBuffer)
const vocals = result.sources['vocals'];
const ai = new BrowserAI();
// Load a GGUF model via the Flare engine
await ai.loadModel('llama-3.2-1b-flare');
// Generate text β same API as MLC/Transformers
const response = await ai.generateText('Explain quantum computing briefly');
// Optional: Load a LoRA adapter
await ai.loadAdapter({ url: 'https://example.com/adapter.safetensors' });
More models will be added soon. Request a model by creating an issue.
We welcome contributions! Feel free to:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ for the AI community
shader-f16 requirement, hardware must support 16-bit floating point operationsTypeScript
98.9%