node-llama-cpp
A strong pick. 3rd of 7 machine learning in JavaScript.
node-llama-cpp is a set of Node.js bindings for llama.cpp. It runs GGUF language models, embeddings and rerankers inside the Node process, and it can force the output to match a JSON schema. It is the most complete way to run an LLM in-process from Node today, but it rests mostly on one maintainer, and native installs are heavy and can break on some hardware.
Best for: Node.js or Electron apps that need local LLM chat, embeddings or schema-constrained output inside the process, without a separate Ollama server.
Scores
Overall7.1
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
For running LLMs in-process in Node, it is the most capable and best-maintained option, and its schema-constrained output is a real advantage. Heavy native installs, platform-specific crashes and a single main maintainer keep it below the category leaders. Transformers.js covers more of the category, in both the browser and Node. Teams that can run a separate service often find Ollama simpler.
- peers Transformers.js: 19.4M downloads per 4 weeks, 172 commits; broader and more active
- github.com/withcatai/node-llama-cpp/releases: Steady releases that follow llama.cpp
- dev.to/jtorchia/the-local-llm-ecosystem-doesnt-need-ollama-and-that-made-me-uncomfortable-15fj: Discussion of Ollama's easier developer experience against direct llama.cpp
GPT-6.2 Sol: 7.6, likely 6.4 to 8.6
For embedded GGUF inference in Node.js, the typed API, structured generation, and steady release cadence make this a strong pick. Transformers.js is the better category default for projects that need browser support or a broader set of model tasks. Native packaging and reliance on a small release team are the main uncertainties for a new project.
- node-llama-cpp.withcat.ai/guide: Documents a complete Node.js workflow for loading models and constraining output.
- evidence.github.releasesLastYear, evidence.github.latestRelease: 21 releases in a year, including a stable update on November 5.
- github.com/withcatai/node-llama-cpp/issues/651: Shows the native packaging work some GPU targets still require.
- npmjs.com/package/node-llama-cpp?activeTab=dependencies: npm lists one collaborator.
- huggingface.co/docs/transformers.js/en/index: Documents the broader browser and model-task coverage of the peer.
Needed by many3.7
How many developers need a tool for this job?
Claude Opus 5.5: 3.5, likely 2.5 to 5.0
Running LLMs on the device from Node is a clear niche, though it is growing with local agents and private embeddings. The project serves only Node and Electron, not the browser, so it covers less of the category than Transformers.js or MediaPipe. It also covers only GGUF LLMs and embedding models, not vision or classic ML.
- github description: Node.js bindings for llama.cpp only
- developers.redhat.com/learning/learn:diving-deeper-large-language-models-and-nodejs/resource/resources:getting-know-ollama-nodejs: Compares in-process node-llama-cpp with Ollama as a separate service
GPT-6.2 Sol: 3.8, likely 2.7 to 5.0
In-process GGUF inference serves a clear niche in desktop apps, offline tools, and Node.js services. Transformers.js also serves browser apps and covers a wider set of model tasks. The Stack Overflow survey measures use of model vendors, leaving demand for locally embedded JavaScript inference uncertain.
- node-llama-cpp.withcat.ai/guide: Documents the native Node.js setup and GGUF workflow.
- huggingface.co/docs/transformers.js/en/index: Documents browser inference across text, vision, and audio tasks.
- survey.stackoverflow.co/2026/technology/data: The survey tracks model vendor use and preference.
Helps a lot7.6
How well does it do the job for those who need it?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
The feature set is rich: JSON-schema-constrained generation, function calling, embeddings, reranking, GPU backends, prebuilt binaries, typed APIs and good docs. It is the most capable in-process LLM runtime for Node. Several things hold it back. Native installs are heavy and fragile on some platforms, and open bugs include segfaults, hangs and silent wrong output. For many apps, Ollama as a separate service is easier.
- github.com/withcatai/node-llama-cpp: Features: Metal, CUDA and Vulkan, JSON schema enforcement, embeddings, reranking
- github.com/withcatai/node-llama-cpp/issues: Open bugs: 664 MB install, segfaults, embed hang, silent output divergence
- github.com/withcatai/node-llama-cpp/releases: Recent releases add structured decisions, lazyMode and Gemma 4 support
- npm hasTypes: Ships TypeScript types
GPT-6.2 Sol: 8.1, likely 7.0 to 9.1
Version 3.22.3 offers streaming chat, embeddings, and schema-constrained generation through a typed API with examples that coding agents can follow. The native binding led the tested configurations in a small Raspberry Pi 5 study. A DGX Spark user reported a silent fallback to CPU, and performance and setup still vary across hardware and models.
- node-llama-cpp.withcat.ai/guide: Shows TypeScript examples, GPU diagnostics, and model-specific function calling.
- github.com/withcatai/node-llama-cpp/releases/tag/v3.22.3: The stable release fixes Unicode length checks for schema parsing.
- science.lpnu.ua/sites/default/files/journal-paper/2025/nov/41049/vse-113-118.pdf: The native binding reached about eight tokens per second in the fastest tested setup on one device.
- github.com/withcatai/node-llama-cpp/issues/651: A downstream user reported a silent CPU fallback and verified a CUDA source build.
Holds up over time6.3
Will it still be a good choice in two years?
Claude Opus 5.5: 5.5, likely 4.0 to 7.0
Releases are frequent and recent: 21 in the last year, with the latest on 5 November 2026, and each follows llama.cpp's breaking changes quickly. But giladgd appears to carry most of the work, there is one GitHub sponsor, and the repository had 50 commits in a year. That is a real bus-factor risk for a native binding that must chase upstream all the time. A v4.0.0 milestone suggests breaking changes are coming.
- github releasesLastYear: 21 releases, latest v3.22.3 in Nov 2026
- github commitsLastYear: 50 commits, 19 contributors in total
- github.com/sponsors/giladgd: Main maintainer has a single sponsor
- github.com/withcatai/node-llama-cpp/issues: Several recent bugs still wait for triage; v4.0.0 milestone exists
GPT-6.2 Sol: 7.0, likely 5.7 to 8.1
The project made 50 commits and shipped 21 releases in the past year, and a maintainer responded to a hardware report within a week. GitHub Sponsors shows funding, while npm lists one collaborator. QMD had to change its cleanup code after a minor update, and the open v4 milestone leaves the timing and scope of the next upgrade uncertain.
- evidence.github: 50 commits and 21 releases in the past year, with 19 contributors listed.
- github.com/withcatai/node-llama-cpp/issues/651: The maintainer responded within six days and followed up on hardware testing.
- github.com/sponsors/giladgd: Lists three current sponsors, including OpenClaw.
- npmjs.com/package/node-llama-cpp?activeTab=dependencies: npm lists one collaborator.
- github.com/tobi/qmd/releases/tag/v2.8.3: QMD adjusted cleanup after version 3.20 made sequence disposal asynchronous.
- github.com/withcatai/node-llama-cpp/milestone/2: The open v4 milestone still lists image input and native log probabilities.
Used widely4.7
How many use it, and is that growing?
Claude Opus 5.5: 5.0, likely 3.5 to 6.5
Downloads rose about 35 times in a year, to 1.58M per 4 weeks, far above the 4.1 median. Much of that likely comes from tools that install it, such as QMD and the OpenClaw llama-cpp plugin, rather than from developers choosing it directly. ecosyste.ms finds only 1 repository and 3 packages that depend on it, and it has 2.2k stars, both far below its peers. Direct choices are probably in the thousands to low tens of thousands, and that number is growing.
- npm downloadsLast4Weeks: 1,576,105, against 44,590 a year before
- dependents: 1 repo and 3 packages, very low next to peers
- github stars: 2,207 stars, against 16k-39k for peers
- docs.openclaw.ai/plugins/llama-cpp: OpenClaw's local embedding plugin installs node-llama-cpp
GPT-6.2 Sol: 4.3, likely 2.8 to 6.0
Four-week npm downloads rose from 44,590 to 1.58 million, about 35 times year over year against a catalog median of 4.1 times. OpenClaw formerly installed it by default and has since moved to a managed llama-server, while QMD still brings it in for local search. The collector found one dependent repository and three npm packages, with less social activity than WebLLM or Transformers.js. The share of downloads from projects choosing it directly is uncertain.
- evidence.npm.downloadsLast4Weeks, evidence.npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: Download growth is about 35.3 times against the catalog median of 4.1 times.
- evidence.dependents, evidence.bluesky, peers: The index found one repository and three npm packages, with zero Bluesky links collected.
- github.com/openclaw/openclaw/issues/17988: A user documented the former default install through OpenClaw.
- docs.openclaw.ai/gateway/doctor/config-migrations: OpenClaw documents its move away from the in-process binding.
- github.com/tobi/qmd/blob/main/README.md: QMD uses the library for embeddings, reranking, and query expansion.
Vouched for5.8
Who stands behind it being good?
Claude Opus 5.5: 5.0, likely 3.5 to 6.5
Well-known projects build on it: QMD uses it for all embeddings, OpenClaw ships a plugin around it, and LangChain.js has an integration. There are no survey results, independent benchmarks or wide production write-ups. Hacker News and Bluesky show almost no attention.
- github.com/tobi/qmd/pull/604: QMD relies on node-llama-cpp for local embeddings
- js.langchain.com/docs/integrations/llms/llama_cpp: LangChain.js integration is built on it
- hackerNews and bluesky: 1 HN story with 2 points; 0 Bluesky posts
GPT-6.2 Sol: 6.5, likely 5.3 to 7.7
QMD ships it for local search, and Clippy uses it to run models on desktop hardware. Electron’s maintainers chose it for an experimental reference implementation. The independent Raspberry Pi study supports its use on small edge devices, while evidence from larger deployments and library-specific satisfaction surveys is sparse.
- github.com/tobi/qmd/blob/main/README.md: QMD uses it for three model tasks in its released search tool.
- github.com/felixrieseberg/clippy: Clippy uses it for local inference and GPU detection.
- github.com/electron/llm/blob/main/README.md: Electron’s experimental package uses it for streaming local inference.
- science.lpnu.ua/sites/default/files/journal-paper/2025/nov/41049/vse-113-118.pdf: Independent comparison covers two small models on one Raspberry Pi.
Safe6.2
How safe is it to depend on?
Claude Opus 5.5: 6.0, likely 4.5 to 7.5
No advisories are known, and the licence is MIT. Other things widen the attack surface. The package pulls in 28 dependencies and large native binaries. It can download and build llama.cpp from source at install time. An open issue asks to bump simple-git past an unpatched CVE range, and another asks for hash checks on git clones. There is no Scorecard, Windows binaries are unsigned, and releases go through CI with one main maintainer.
- advisories total: 0 advisories
- npm dependencies: 28 direct dependencies
- scorecard: No OpenSSF Scorecard
- github.com/withcatai/node-llama-cpp/issues: simple-git CVE bump, unsigned addon, hash verification requests
GPT-6.2 Sol: 6.4, likely 5.0 to 7.6
The package uses the permissive MIT license, and OSV lists zero advisories for the npm package. GitHub Actions automates releases with OIDC permissions, and npm lists one collaborator. The package brings 28 direct dependencies and loads native code in the app process, where upstream GGUF parser bugs matter. The missing OpenSSF Scorecard and public security policy make its security practices harder to assess.
- evidence.npm.license, evidence.npm.dependencies, evidence.advisories, evidence.scorecard: MIT, 28 dependencies, zero package advisories, and no collected Scorecard result.
- raw.githubusercontent.com/withcatai/node-llama-cpp/v3.22.3/.github/workflows/build.yml: The release job uses semantic-release and requests OIDC credentials.
- npmjs.com/package/node-llama-cpp?activeTab=dependencies: The npm listing names one collaborator.
- github.com/withcatai/node-llama-cpp/security: GitHub lists no public security policy or advisories for the wrapper.
- github.com/ggml-org/llama.cpp/security/advisories/GHSA-96jg-mvhq-q7q7: Upstream published a fix for a GGUF parser flaw in an older build.
- science.lpnu.ua/sites/default/files/journal-paper/2025/nov/41049/vse-113-118.pdf: The native binding shares the application's process and memory.
Good
- It enforces a JSON schema or grammar while the model generates, and supports function calling, so local models return structured output reliably.
- Prebuilt binaries for macOS, Linux and Windows with Metal, CUDA and Vulkan mean most users need no compiler.
- It tracks llama.cpp closely, with 21 releases in the last year, so new models such as Gemma 4 work soon after llama.cpp supports them.
- It is TypeScript-first, has good documentation and a CLI, and has a LangChain.js integration.
Bad
- It runs in Node only, not in the browser, which makes it narrower than Transformers.js or WebLLM.
- The native install is large (an open issue reports about 664 MB on Linux x64) and fails on some platforms, such as Jetson boards, Windows with Smart App Control and some pnpm lockfile setups.
- Open issues report crashes and silent wrong output on some hardware and models, such as segfaults, embed hangs, repeating Gemma output and diverging embeddings.
- One maintainer does most of the work, with little sponsorship.
The numbers
- npm downloads, 4 weeks
- 1.6M ×35 in a year
- GitHub stars
- 2.2k
- Commits, 12 months
- 50
- npm version
- 3.22.3 Nov 2026
- Versions, 12 months
- 21
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- None
- Licence
- MIT
Read on 21 November 2026 from GitHub (withcatai/node-llama-cpp), npm (node-llama-cpp), OSV and the OpenSSF Scorecard.
Machine learning in JavaScript
- 8.4Transformers.js
- 7.8MediaPipe Tasks
- 7.1node-llama-cpp
- 6.8WebLLM
- 6.6Tesseract.js
- 4.5TensorFlow.js
- 2.7brain.js