Skip to content
PluginStats

ai-sdk-llama-cpp weekly downloads statistics

By lgrammel · npm · AI SDKs

A minimal llama.cpp provider for the Vercel AI SDK implementing LanguageModelV3 and EmbeddingModelV3

View on npm Fresh · Oct 17, 2026

ai-sdk-llama-cpp has 91 recorded weekly downloads on npm, a decrease of 89.3% over the past 30 days.

It ranks #1683 of 2,256 tracked npm listings by weekly downloads.

Over 90 days, weekly downloads changed by -68.0%.

PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.

Weekly downloads
91
Official API · Oct 17, 2026
7-day growth
-47.1%
-81 weekly downloads
30-day growth
-89.3%
-759 weekly downloads
90-day growth
-68.0%
-193 weekly downloads
Rank
#1683
Among tracked npm listings

About ai-sdk-llama-cpp

ai-sdk-llama-cpp

Alpha Software - This package is in early development. The API may change between versions without notice.

macOS Only - This package currently only supports macOS with Apple Silicon or Intel processors.

A minimal llama.cpp provider for the Vercel AI SDK, implementing the LanguageModelV3 interface.

This package loads llama.cpp directly into Node.js memory via native C++ bindings, enabling local LLM inference without requiring an external server.

Features

• Native Performance: Direct C++ bindings using node-addon-api (N-API) • GPU Acceleration: Automatic Metal support on macOS • Streaming & Non-streaming: Full support for both generateText and streamText • Structured Output: Generate JSON objects with schema validation using generateObject • Tool/Function Calling: Support for AI SDK tools with automatic tool call detection • Chat Templates: Automatic or configurable chat template formatting (llama3, chatml, gemma, etc.) • ESM Only: Modern ECMAScript modules, no CommonJS • GGUF Support: Load any GGUF-format model

Prerequisites

Before installing, ensure you have the following:

• macOS (Apple Silicon or Intel) • Node.js >= 18.0.0 • CMake >= 3.15 • Xcode Command Line Tools

Installation

The installation will automatically:

1. Detect macOS and verify platform compatibility 2. Compile llama.cpp as a static library with Metal support 3. Build the native Node.js addon

Note: Installation on Windows or Linux will fail with an error. Only macOS is supported.

Usage

Basic Example

Streaming Example

Structured Output

Generate type-safe JSON objects that conform to a schema using generateObject:

The structured output feature uses GBNF grammar constraints to ensure the model generates valid JSON that conforms to your schema. This works with:

• Primitive types: string, number, integer, boolean, null • Objects: With properties, required, and additionalProperties • Arrays: With items, minItems, maxItems • Enums and constants: enum, const • Composition: oneOf, anyOf, allOf • String constraints: minLength, maxLength, pattern • Number constraints: minimum, maximum (for integers) • String formats: date, time, date-time, uuid • References: Local $ref to $defs/definitions

Tool Calling Example

Use AI SDK tools with local models. The model decides when to call tools based on the conversation context:

Tool calling also works with streamText. When tools are provided, the provider automatically detects tool call JSON output and emits proper tool-call events instead of streaming raw JSON as text.

Note: Tool calling quality depends heavily on the model. Models fine-tuned for function calling (e.g., Llama 3.1+, Hermes 2/3, Functionary, Qwen 2.5) work best. Generic models may produce inconsistent results.

Embedding Example

Configuration Options

Chat Templates

The chatTemplate option controls how messages are formatted before being sent to the model. Available templates include:

• chatml, llama2, llama2-sys, llama3, llama4 • mistral-v1, mistral-v3, mistral-v7 • phi3, phi4, gemma, falcon3, zephyr • deepseek, deepseek2, deepseek3, command-r • And more (see llama.cpp documentation for the full list)

Generation Parameters

The standard AI SDK generation parameters are supported:

Model Downloads

You'll need to download GGUF-format models separately. Popular sources:

• Hugging Face - Search for GGUF models • TheBloke's Models - Popular quantized models

Example download:

API Reference

llamaCpp(config)

Creates a new llama.cpp language model instance.

Parameters:

• config.modelPath (string, required): Path to the GGUF model file • config.contextSize (number, optional): Maximum context size. Default: 2048 • config.gpuLayers (number, optional): GPU layers to offload. Default: 99 • config.threads (number, optional): CPU threads. Default: 4 • config.debug (boolean, optional): Enable verbose llama.cpp output. Default: false • config.chatTemplate (string, optional): Chat template to use for formatting messages. Default: "auto"

Returns: LlamaCppLanguageModel - A language model compatible with the Vercel AI SDK

LlamaCppLanguageModel

Implements the LanguageModelV3 interface from @ai-sdk/provider.

Methods:

• doGenerate(options): Non-streaming text generation • doStream(options): Streaming text generation • dispose(): Unload the model and free GPU/CPU resources. Always call this when done to prevent memory leaks, especially when loading multiple models

Limitations

This is a minimal implementation with the following limitations:

• macOS only: Windows and Linux are not supported • No image inputs: Only text prompts are supported

Contributing

See CONTRIBUTING.md for development setup and contribution guidelines.

License

MIT

Acknowledgments

• llama.cpp - The underlying inference engine • Vercel AI SDK - The AI SDK framework • node-addon-api - N-API C++ wrapper

Description from the npm listing.

  • ai
  • llama
  • llama.cpp
  • vercel
  • ai-sdk
  • language-model
  • gguf

Where ai-sdk-llama-cpp sits in the listing

Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

All npm2,256 listings · 113 pages · page 85, #4 (overall #1684)
All npm: every listing in weekly downloads order
PNG SVG
AI SDKs250 listings · 13 pages · page 12, #11 (overall #231)
AI SDKs: every listing in weekly downloads order
PNG SVG

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

ai-sdk-llama-cpp weekly downloads on npm, last 90 days: 91 weekly downloads as of Oct 17, 2026, -68.0% over 90 days.ai-sdk-llama-cppWeekly downloads on npm · Last 90 days91downloads / week-68.0% over 90 days05001K1.5K2KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 21, 2026 – Oct 17, 2026 · 89 observations · Updated Oc…pluginstats.com
ai-sdk-llama-cpp weekly downloads on npm, last 90 days: 91 weekly downloads as of Oct 17, 2026, -68.0% over 90 days.
PNG SVG

7/30/90-day growth

ai-sdk-llama-cpp weekly downloads growth on npm: -47.1% over 7 days, -89.3% over 30 days, -68.0% over 90 days.ai-sdk-llama-cppWeekly downloads growth on npm91downloads / week now7-day growth-81 weekly downloads-47.1%30-day growth-759 weekly downloads-89.3%90-day growth-193 weekly downloads-68.0%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
ai-sdk-llama-cpp weekly downloads growth on npm: -47.1% over 7 days, -89.3% over 30 days, -68.0% over 90 days.
PNG SVG

Ranking history

ai-sdk-llama-cpp npm ranking history: currently #1683 (by weekly downloads).ai-sdk-llama-cppnpm ranking · by weekly downloads · Last 90 days#1683current rank#1676#1678#1680#1682#1684#1686Jul 21Aug 5Aug 20Sep 4Sep 19Oct 4Oct 19rankOct 18, 2026 – Oct 19, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
ai-sdk-llama-cpp npm ranking history: currently #1683 (by weekly downloads).
PNG SVG

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Recent observations

Full history (121)
Recent weekly downloads observations for ai-sdk-llama-cpp
Date (UTC)Weekly downloadsChange vs. previous
91-21
112+52
60-30
90-104
1940
194+11
183+11
172-12
184-18
202-80
282+99
183-147
330-287
617—

Similar npm AI SDKs plugins

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/ai-sdk-llama-cpp. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.