wllama runs llama.cpp inside the browser via WebAssembly, loading GGUF models with optional WebGPU offload and an OpenAI-style API for chat and tooling.
Overview
wllama is a WebAssembly binding for llama.cpp that enables large language model inference directly in the browser without a server round trip for the model weights. It targets web apps that need local or client-side LLM chat, embeddings, or multimodal input while keeping inference inside a worker so the page UI stays responsive.
The library exposes an OpenAI-compatible typed API, supports tool calling, and can load GGUF files larger than four gigabytes by splitting across memory limits and worker instances. WebGPU acceleration offloads layers when VRAM allows, with remaining layers on CPU. Features described include speculative decoding, LoRA adapters, multimodal image audio and video input, speech transcription and text-to-speech flows, and caching of models in OPFS for faster reloads.
Consumers import the npm package, optionally build WASM binaries locally with Docker, and load models from URLs or Hugging Face. Multi-thread and single-thread builds switch based on browser capabilities. Realtime audio sessions follow event shapes similar to OpenAI’s realtime API for supported omni models.
A demo space on Hugging Face illustrates conversational use: users type prompts in the browser and receive model replies through the embedded stack.
Key features
- llama.cpp via WebAssembly
- OpenAI-compatible client API
- WebGPU plus CPU layer split
- Large GGUF and split file support
- OPFS model caching
- Worker-based non-blocking inference
- Multimodal and speech capabilities
- Speculative decoding and LoRA
Use cases
- In-browser chat with local models
- Privacy-sensitive client-side LLM UIs
- Web demos without inference servers
- Embeddings in frontend applications
- Realtime transcription in the browser