SkillAgentSearch skills...

Llm.js

Run Large-Language Models (LLMs) ๐Ÿš€ directly in your browser!

Install / Use

/learn @rahuldshetty/Llm.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<div align="center" style="display:flex; align-items:center;justify-content: center;background:#e1e1e1;color:#0f0f0f;padding:50px;"> <img alt="llm.js logo" src="https://raw.githubusercontent.com/rahuldshetty/llm.js/master/docs/_media/logo.jpg"> </div> <p align="center"> <img alt="no-languages" src="https://img.shields.io/github/languages/count/rahuldshetty/llm.js?color=red&style=flat-square"> <img alt="commit-activity" src="https://img.shields.io/github/commit-activity/w/rahuldshetty/llm.js?color=green&style=flat-square"> <img alt="stars" src="https://img.shields.io/github/stars/rahuldshetty/llm.js?style=social"> </p>

LLM.js

Run Large-Language Models (LLMs) ๐Ÿš€ directly in your browser!

<p align="center"> <img alt="Sample" src="https://raw.githubusercontent.com/rahuldshetty/llm.js/master/docs/_media/demo.gif"> </p>

Example projects๐ŸŒโœจ: Live Demo

Learn More: Documentation

Models Supported:

Features

  • Run inference directly on browser (even on smartphones) with power of WebAssembly
  • Guidance: Structure responses with CFG Grammar and JSON schema
  • Developed in pure JavaScript
  • Web Worker to perform background tasks (model downloading/inference)
  • Model Caching support
  • Pre-built packages to directly plug-and-play into your web apps.

Installation

Download and extract the latest release of the llm.js package to your web application๐Ÿ“ฆ๐Ÿ’ป.

Quick Start

// Import LLM app
import {LLM} from "llm.js/llm.js";

// State variable to track model load status
var model_loaded = false;

// Initial Prompt
var initial_prompt = "def fibonacci(n):"

// Callback functions
const on_loaded = () => { 
    model_loaded = true; 
}
const write_result = (text) => { document.getElementById('result').innerText += text + "\n" }
const run_complete = () => {}

// Configure LLM app
const app = new LLM(
     // Type of Model
    'GGUF_CPU',

    // Model URL
    'https://huggingface.co/RichardErkhov/bigcode_-_tiny_starcoder_py-gguf/resolve/main/tiny_starcoder_py.Q8_0.gguf',

    // Model Load callback function
    on_loaded,          

    // Model Result callback function
    write_result,       

     // On Model completion callback function
    run_complete       
);

// Download & Load Model GGML bin file
app.load_worker();

// Trigger model once its loaded
const checkInterval = setInterval(timer, 5000);

function timer() {
    if(model_loaded){
            app.run({
            prompt: initial_prompt,
            top_k: 1
        });
        clearInterval(checkInterval);
    } else{
        console.log('Waiting...')
    }
}
View on GitHub
GitHub Stars228
CategoryDevelopment
Updated11d ago
Forks16

Languages

JavaScript

Security Score

100/100

Audited on Mar 17, 2026

No findings