Skip to content

Installation

Terminal window
npm install vitamem

Vitamem requires Node.js 18 or later.

Vitamem ships built-in adapters for OpenAI, Anthropic, and Ollama. Install the peer dependency for your chosen provider.

Terminal window
npm install openai
import { createVitamem } from "vitamem";
const mem = await createVitamem({
provider: "openai",
apiKey: process.env.OPENAI_API_KEY!,
storage: "ephemeral",
});

Default models: gpt-5.4-mini (chat) and text-embedding-3-small (embeddings).

All provider SDKs are optional peer dependencies. You only need to install the one you use.

ProviderPeer dependencyMinimum version
OpenAIopenai>= 4.0.0
Anthropic@anthropic-ai/sdk>= 0.30.0
OllamaNone
Supabase@supabase/supabase-js>= 2.0.0

Vitamem is written in TypeScript and ships with full type declarations. No additional @types package is needed.

Recommended tsconfig.json settings:

{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true
}
}

Vitamem is published as ESM ("type": "module"). If your project uses CommonJS, you may need to use dynamic import() or switch to ESM.

Vitamem supports two built-in storage options:

  • "ephemeral" — In-memory storage. Data is lost when the process exits. Great for development and testing.
  • "supabase" — Persistent storage backed by Supabase (Postgres + pgvector). Use this for production.
// Development
const mem = await createVitamem({
provider: "openai",
apiKey: process.env.OPENAI_API_KEY!,
storage: "ephemeral",
});
// Production
const mem = await createVitamem({
provider: "openai",
apiKey: process.env.OPENAI_API_KEY!,
storage: "supabase",
supabaseUrl: process.env.SUPABASE_URL!,
supabaseKey: process.env.SUPABASE_KEY!,
});

You can also pass a custom StorageAdapter instance for other backends. See Custom Storage.

  • Quickstart — Build your first health companion in 5 minutes
  • Tutorial — Step-by-step guide to building a health companion from scratch