Skip to main content
The Node.js SDK is published as @memvid/sdk. It includes a native addon (N-API) and a fully-typed TypeScript API.

Install

npm install @memvid/sdk
# or: pnpm add @memvid/sdk
Requirements: Node.js 18+. Prebuilt binaries ship for common platforms; if your platform isn’t covered, build from source.

Quick Start

import { create, open, use } from "@memvid/sdk";

// Create new memory
const mem = await create("notes.mv2");
await mem.put({
  title: "Hello Memvid",
  label: "demo",
  text: "Hello from Node.js",
  enableEmbedding: true,
});
await mem.seal(); // commits writes

// Open existing memory (read-only)
const ro = await open("notes.mv2", "basic", { readOnly: true });
const results = await ro.find("hello", { k: 5, mode: "auto" });
console.log(results.hits.map((h: any) => h.title));

// Framework adapters (tools/functions)
const lc = await use("langchain", "notes.mv2", { readOnly: true });
console.log(Object.keys(lc.tools ?? {}));
  • MEMVID_OFFLINE=1 disables model downloads and remote calls (you must provide embeddings/LLM keys explicitly).
  • Provider keys (optional): OPENAI_API_KEY, GEMINI_API_KEY, ANTHROPIC_API_KEY, COHERE_API_KEY, VOYAGE_API_KEY.
seal() is a write operation (it commits). For read-only usage, do not call seal(). Just keep the handle around and reuse it.