MemoryX
SDK Integration Guide

Integrate MemoryX into Your App

Use Node.js or Python SDK to add memory capabilities to your app in minutes

Node.js SDK

TypeScript Support

npm install @t0ken.ai/memoryx-sdk
View Usage

Python SDK

Python 3.8+

pip install t0ken-memoryx
View Usage

0 How It Works

1

SDK initialization without API Key

2

Call autoRegister() to auto-register and get API Key

3

Important: Save the API Key to your business system (database/config file)

4

Next time, initialize with saved API Key, memory data will be automatically linked

Memory data follows the API Key. The same API Key can access the same memories on any device.

1 Node.js SDK

Install

npm install @t0ken.ai/memoryx-sdk

First Time Use - Auto Register for API Key

import { APIClient } from '@t0ken.ai/memoryx-sdk';

// First time: no API Key needed
const client = new APIClient();

// Auto register, get API Key
const account = await client.autoRegister('my-app', 'My Application');

console.log('API Key:', account.api_key);
console.log('Project ID:', account.project_id);

// ⚠️ Important: Save API Key to your database or config file!

Subsequent Use - With Saved API Key

import { APIClient } from '@t0ken.ai/memoryx-sdk';

// Read saved API Key from your storage
const savedApiKey = await db.getApiKey(userId);

// Initialize with saved API Key
const client = new APIClient({ apiKey: savedApiKey });

// Add memory
await client.sendMemories([
  { content: 'User prefers dark theme', metadata: { category: 'semantic' } }
]);

// Search memories
const results = await client.search('user preference');

Main Methods

autoRegister() Auto register to get API Key
sendMemories() Send memories (single/batch)
search() Semantic search memories
list() Get memory list
delete() Delete memory
getTaskStatus() Query async task status

2 Python SDK

Install

pip install t0ken-memoryx

First Time Use - Auto Register for API Key

from memoryx import APIClient

# First time: no API Key needed
client = APIClient()

# Auto register, get API Key
account = client.auto_register("my-app", "My Application")

print(f"API Key: {account['api_key']}")
print(f"Project ID: {account['project_id']}")

# ⚠️ Important: Save API Key to your database or config file!

Subsequent Use - With Saved API Key

from memoryx import APIClient

# Read saved API Key from your storage
saved_api_key = db.get_api_key(user_id)

# Initialize with saved API Key
client = APIClient(api_key=saved_api_key)

# Add memory
client.send_memories([
    {"content": "User prefers dark theme", "metadata": {"category": "semantic"}}
])

# Search memories
results = client.search("user preference")

Main Methods

auto_register() Auto register to get API Key
send_memories() Send memories (single/batch)
search() Semantic search memories
list() Get memory list
delete() Delete memory
get_task_status() Query async task status

3 Memory Categories

episodic

Episodic memory - specific events and experiences

semantic

Semantic memory - facts and concepts

procedural

Procedural memory - skills and methods

emotional

Emotional memory - preferences and feelings

reflective

Reflective memory - summaries and reflections

Need More Help?