web-llm (mlc-ai/web-llm)

Searching Database…

What is this?WebLLM runs large language models directly in the browser, accelerated by WebGPU — no server involved. It exposes the OpenAI API, so standard OpenAI-style code works against open models running locally.
So is it a ready-made chatbot, or a library I build my own app with?A library: the npm package @mlc-ai/web-llm gives you a modular inference engine you hook up to any UI. WebLLM Chat is a separate, ready-to-use app built on top of it.
How do I add it to my project and get a model running?npm install @mlc-ai/web-llm, or import it straight from a CDN — it works out-of-the-box on jsfiddle, Codepen and Scribbler. Then call CreateMLCEngine(model) and use engine.chat.completions like the OpenAI SDK.
Do I need my own server or an OpenAI API key for this?Neither — everything runs inside the browser. The one real requirement is a browser with WebGPU support, since all the acceleration goes through it.
What's the catch on a user's very first load?The model weights have to download first, which can take a significant amount of time — handle it as async. After that they're cached: Cache API by default, with IndexedDB, OPFS or an experimental cross-origin extension as options.
Does any of my conversation data leave the machine?No — inference happens locally in the browser. The project frames this as the point: build AI assistants that enable privacy while still enjoying GPU acceleration.
Can I build a Chrome extension on top of it?Yes — the repo ships Chrome extension examples, including one backed by a service worker so it stays persistent in the background; WebLLM Assistant is referenced as a fuller real-world extension built with WebLLM.
How do I run a model that's not on the built-in list?Compile it with MLC LLM, WebLLM's companion project: a model is weight artifacts plus a WebAssembly model library, and you point WebLLM at both via its config. One model library can even be shared across weight variants.
What actually gets downloaded when a model loads?Per model: the weights with metadata, a WebAssembly library with the accelerated compute, and config/tokenizer files — each referenced by URL in the model record, so all of it is customizable. Downloads can also be SRI-verified for integrity.
What are similar projects?TypeLLM, repomix, airllm, cardputer-ai, Edge0, transformers.js, uzu, quivr
Creator
mlc-ai
Size
68 MB
Stars
19.4K
Age
3y
Commits · 90 Days