# BrowserAI: Run Local LLMs Directly in Your Browser with WebGPU

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/sauravpanda-browserai
Generated for open source discovery and AI-assisted research.

BrowserAI is an innovative open-source project that enables running large language models (LLMs) directly within your web browser. Leveraging WebGPU for accelerated performance, it offers a private, cost-free, and offline-capable solution for integrating AI into web applications. Developers can easily build powerful, privacy-conscious AI experiences without server-side infrastructure.

GitHub: https://github.com/sauravpanda/BrowserAI
OSRepos URL: https://osrepos.com/repo/sauravpanda-browserai

## Summary

BrowserAI is an innovative open-source project that enables running large language models (LLMs) directly within your web browser. Leveraging WebGPU for accelerated performance, it offers a private, cost-free, and offline-capable solution for integrating AI into web applications. Developers can easily build powerful, privacy-conscious AI experiences without server-side infrastructure.

## Topics

- ai
- llm
- webgpu
- browser
- typescript
- local-inference
- privacy
- agents

## Repository Information

Last analyzed by OSRepos: Fri Nov 21 2025 20:01:31 GMT+0000 (Western European Standard Time)
Detail views: 11
GitHub clicks: 14

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction
BrowserAI is an open-source project that revolutionizes how developers integrate large language models (LLMs) into web applications. It allows you to run powerful LLMs, such as Llama, DeepSeek-Distill, and Kokoro, entirely within the user's browser. This approach ensures 100% privacy, eliminates server costs, and provides offline capabilities, making it ideal for a wide range of AI-powered web solutions. The project leverages WebGPU for near-native performance, offering a fast and efficient way to deploy AI directly on the client side.

## Installation
Getting started with BrowserAI is straightforward. You can install it using npm or yarn:

bash
npm install @browserai/browserai


OR

bash
yarn add @browserai/browserai


## Examples

### Basic Usage

javascript
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);


### Chat with System Prompt

javascript
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?' }
]);
console.log(response.choices[0].message.content);


### Structured Output Generation

javascript
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" }
});
console.log(response.choices[0].message.content);


## Why Use BrowserAI?
BrowserAI offers compelling advantages for developers and businesses looking to integrate AI:
*   **100% Private**: All AI processing occurs locally in the user's browser, ensuring data privacy and security.
*   **Zero Server Costs**: Eliminate the need for expensive server infrastructure for AI inference, reducing operational costs significantly.
*   **Offline Capable**: Once models are downloaded, applications can function without an internet connection, enhancing accessibility and reliability.
*   **WebGPU Accelerated**: Benefit from near-native performance thanks to WebGPU acceleration, providing a fast and responsive user experience.
*   **Developer Friendly**: A simple SDK and API make it easy to integrate various LLMs, speech recognition, and text-to-speech capabilities into web projects.
*   **Production Ready**: Utilizes pre-optimized popular models, ready for deployment in real-world applications.

## Links
*   [Live Demo](https://chat.browserai.dev){:target="_blank"}
*   [Documentation](https://docs.browserai.dev){:target="_blank"}
*   [GitHub Repository](https://github.com/sauravpanda/BrowserAI){:target="_blank"}