{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "mlc-ai-web-llm--add-a-private-in-browser-chatbot-with-web-llm",
 "repo": "mlc-ai/web-llm",
 "repo_url": "https://github.com/mlc-ai/web-llm",
 "repo_slug": "mlc-ai-web-llm",
 "title": "Add a private chatbot that runs in the browser",
 "page_title": "How to add a private chatbot that runs in the browser with Web LLM",
 "summary": "Load a model with CreateMLCEngine and call engine.chat.completions.create with OpenAI style messages, all on the visitor's device.",
 "who": "A web developer adding an assistant to a site or internal tool.",
 "problem": "Hosted LLM APIs cost money per token and send user text to a server.",
 "outcome": "A working chat reply generated locally in the browser.",
 "steps": [
  "Install with `npm install @mlc-ai/web-llm`",
  "Import CreateMLCEngine and create an engine for Llama-3.1-8B-Instruct-q4f32_1-MLC with an initProgressCallback to show loading progress",
  "Call engine.chat.completions.create with your messages",
  "Read reply.choices[0].message and reply.usage"
 ],
 "agent_prompt": "Using mlc-ai/web-llm, build a minimal page that loads Llama-3.1-8B-Instruct-q4f32_1-MLC with a progress bar and answers questions with engine.chat.completions.create.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "1 hour",
 "basis": "readme",
 "caveat": "The README says the model parameter in chat.completions.create is ignored; choose the model in CreateMLCEngine or engine.reload.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "",
 "requirements": [
  "A browser with WebGPU support on a device with a capable GPU",
  "Node with npm, yarn or pnpm: `npm install @mlc-ai/web-llm`, or import from the jsdelivr CDN",
  "Bandwidth and storage for the first model download, which the README warns can take a significant amount of time"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "platform",
   "notice": "WebGPU is needed, and low end phones or laptops may be too slow or run out of memory for 8B models."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/mlc-ai-web-llm/add-a-private-in-browser-chatbot-with-web-llm/",
 "md": "https://dedupedai.com/use-cases/mlc-ai-web-llm/add-a-private-in-browser-chatbot-with-web-llm/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/mlc-ai-web-llm--add-a-private-in-browser-chatbot-with-web-llm.json",
 "api_version": "v1"
}
