Quick Start

Quick Start

Get started with DeltaMemory in under 5 minutes.

1. Create Your Account

  1. Go to app.deltamemory.com (opens in a new tab)
  2. Sign up with your email or OAuth provider
  3. Create your first project

After signing up, you'll receive:

  • Your unique API endpoint URL (e.g., https://api-us-east-1.deltamemory.com)
  • Your first API key (starts with dm_)

2. Install the SDK

npm install deltamemory

3. Set Environment Variables

export DELTAMEMORY_API_KEY=dm_your_api_key_here
export DELTAMEMORY_URL=https://api-us-east-1.deltamemory.com

4. Hello World Example

import { DeltaMemory } from 'deltamemory';
 
const db = new DeltaMemory({
  apiKey: process.env.DELTAMEMORY_API_KEY,
  baseUrl: process.env.DELTAMEMORY_URL,
  defaultCollection: 'my-app'
});
 
async function main() {
  // Ingest with cognitive processing
  await db.ingest('I love TypeScript and building AI applications');
  
  // Recall with structured context
  const result = await db.recall('What do I love?');
  
  console.log('Memories:', result.results);
  console.log('Profiles:', result.profiles);
  console.log('Context:', result.context);
}
 
main();

Expected output:

Memories: [Memory(content='I love Python and building AI applications', ...)]
Profiles: [UserProfile(topic='interests', sub_topic='language', content='Python'), ...]
Context: # User Memory\n## User Profile\n- interests::language: Python\n...

5. Verify Connection

Check that your connection is working:

curl -H "X-API-Key: $DELTAMEMORY_API_KEY" $DELTAMEMORY_URL/v1/health

Expected response:

{
  "healthy": true,
  "version": "0.1.0"
}

What Just Happened?

  1. Ingest - DeltaMemory processed your content and:

    • Created vector embeddings for semantic search
    • Extracted facts about your interests
    • Built a user profile with structured data
  2. Recall - DeltaMemory searched using hybrid scoring:

    • Semantic similarity (meaning)
    • Recency (time)
    • Salience (importance)
  3. Profile - Structured facts were automatically extracted and organized by topic

Next Steps

Build a Chatbot

async function chat(userId: string, message: string) {
  const db = new DeltaMemory({
    apiKey: process.env.DELTAMEMORY_API_KEY,
    baseUrl: process.env.DELTAMEMORY_URL,
    defaultCollection: `user-${userId}`
  });
  
  // Recall relevant context
  const memory = await db.recall(message, { limit: 5 });
  
  // Use memory.context in your LLM prompt
  const prompt = `${memory.context}\n\nUser: ${message}\nAssistant:`;
  const response = await generateResponse(prompt);
  
  // Store the conversation
  await db.ingest(`User: ${message}\nAssistant: ${response}`);
  
  return response;
}

Use with Vercel AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { deltaMemoryTools, DeltaMemory } from '@deltamemory/ai-sdk';
 
const client = new DeltaMemory({
  apiKey: process.env.DELTAMEMORY_API_KEY,
  baseUrl: process.env.DELTAMEMORY_URL
});
 
const { text } = await generateText({
  model: openai('gpt-4'),
  messages: [{ role: 'user', content: 'What are my preferences?' }],
  tools: {
    ...deltaMemoryTools(client, { userId: 'user-123' })
  }
});

Common Issues

"Invalid API key"

  • Check your API key starts with dm_
  • Verify it's set in environment variables
  • Try regenerating from dashboard

"Connection refused"

  • Check your endpoint URL is correct
  • Verify it starts with https://
  • Test with: curl $DELTAMEMORY_URL/v1/health

"Empty recall results"

  • Make sure you ingested content first
  • Try a broader query
  • Check you're using the same collection

Learn More