Installation

Get up and running faster than a yarn install âš¡

Install the Package

Choose your favorite package manager:

# npm (the classic)
npm install memofai

# yarn (the hipster choice)
yarn add memofai

# pnpm (the fast one)
pnpm add memofai

Get Your API Token

  1. Visit dashboard.memof.ai/access-tokens
  2. Click "Create New Token"
  3. Copy it (starts with moa_...)
  4. Hide it somewhere safe 🤫

Basic Setup

import { createMoaClient } from 'memofai';

const client = createMoaClient({
  apiToken: 'moa_your_token_here',
  environment: 'production'
});

// You're ready to roll! 🎸

JavaScript (CommonJS)

const { createMoaClient } = require('memofai');

const client = createMoaClient({
  apiToken: 'moa_your_token_here',
  environment: 'production'
});

JavaScript (ESM)

import { createMoaClient } from 'memofai';

const client = createMoaClient({
  apiToken: 'moa_your_token_here'
});

Environment Variables

The professional way:

# .env
MEMOFAI_API_TOKEN=moa_your_token_here
MEMOFAI_ENVIRONMENT=production
import { createMoaClient } from 'memofai';

const client = createMoaClient({
  apiToken: process.env.MEMOFAI_API_TOKEN!,
  environment: process.env.MEMOFAI_ENVIRONMENT as any
});

Configuration Options

import { createMoaClient, Environment } from 'memofai';

const client = createMoaClient({
  // Required
  apiToken: 'moa_your_token',
  
  // Optional
  environment: 'production' as Environment, // dev, alpha, beta, sandbox, production
  timeout: 30000,        // Request timeout (ms)
  retries: 3,            // Retry attempts
  retryDelay: 1000       // Delay between retries (ms)
});

TypeScript Configuration

Add to your tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ES2020",
    "lib": ["ES2020"],
    "moduleResolution": "node",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "strict": true
  }
}

Verify Installation

Does it work? Let's find out!

import { createMoaClient } from 'memofai';

const client = createMoaClient({
  apiToken: 'moa_your_token'
});

// Try listing workspaces
const workspaces = await client.workspaces.list();
console.log('✅ SDK working! Found', workspaces.length, 'workspaces');

What's Next?

SDK installed? Time to:

  1. Create Workspaces - Organize your bots
  2. Build Bots - Create AI agents
  3. Store Memories - Make them remember

Let's build something cool! 🚀