mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-11 03:37:56 +00:00
Rewrites 339 TypeScript calls across 50 pages from the rc.5 `method({ namespace, body })` form to the shipped `method(namespace, { ... })` form, and aligns field names with the live v5 spec: `attach` to `include`, `authUrl` to `authorization`, `lastSync` to `latestRun`, `deletedCount` to `count`, and the paginated `namespaces.list()`.
Renames container tags to namespaces across concepts, connectors, integrations and snippets. The namespace pages keep container tag in the description, search keywords and a rename note so old searches still land, and the v3 reference page points at v5.
The migration guide's SDK table now covers both 5.0.0 SDKs, and the SDK integration page uses the real client options (`baseUrl`, `timeoutInSeconds`, `maxRetries`) and error classes.
249 lines
5.9 KiB
Text
249 lines
5.9 KiB
Text
---
|
|
title: "Migrating from Mem0 to Supermemory"
|
|
description: "Complete guide to migrate your data and applications from Mem0 to Supermemory"
|
|
sidebarTitle: "From Mem0"
|
|
---
|
|
|
|
Migrating from Mem0 to Supermemory is straightforward. This guide walks you through exporting your memories from Mem0 and importing them into Supermemory.
|
|
|
|
## Why migrate to Supermemory?
|
|
|
|
Supermemory offers enhanced capabilities over Mem0:
|
|
- **Knowledge graph** architecture for better context relationships
|
|
- **Multiple content types** (URLs, PDFs, images, videos)
|
|
- **Generous free tier** (100k tokens) with affordable pricing
|
|
- **Multiple integration options** (API, MCP, SDKs)
|
|
|
|
## Quick migration (all-in-one)
|
|
|
|
Complete migration in one script:
|
|
|
|
```python
|
|
from mem0 import MemoryClient
|
|
from supermemory import Supermemory
|
|
import json, time
|
|
|
|
# Export from Mem0
|
|
mem0 = MemoryClient(api_key="your_mem0_api_key")
|
|
export = mem0.create_memory_export(
|
|
schema={"type": "object", "properties": {"memories": {"type": "array", "items": {"type": "object"}}}},
|
|
filters={}
|
|
)
|
|
time.sleep(5)
|
|
data = mem0.get_memory_export(memory_export_id=export["id"])
|
|
|
|
# Import to Supermemory
|
|
supermemory = Supermemory(api_key="your_supermemory_api_key")
|
|
for memory in data["memories"]:
|
|
if memory.get("content"):
|
|
supermemory.add("imported_from_mem0", content=memory["content"])
|
|
print(f"✅ {memory['content'][:50]}...")
|
|
|
|
print("Migration complete!")
|
|
```
|
|
|
|
## Step-by-step migration
|
|
|
|
<Steps>
|
|
<Step title="Export from Mem0">
|
|
Mem0 provides two ways to export your memories:
|
|
|
|
### Option 1: Export via dashboard (recommended)
|
|
1. Log into your [Mem0 dashboard](https://app.mem0.ai)
|
|
2. Navigate to the export section
|
|
3. Download your memories as JSON
|
|
|
|
### Option 2: Export via API
|
|
|
|
Simple script to export all your memories from Mem0:
|
|
|
|
```python
|
|
from mem0 import MemoryClient
|
|
import json
|
|
import time
|
|
|
|
# Connect to Mem0
|
|
client = MemoryClient(api_key="your_mem0_api_key")
|
|
|
|
# Create export job
|
|
schema = {
|
|
"type": "object",
|
|
"properties": {
|
|
"memories": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {"type": "string"},
|
|
"content": {"type": "string"},
|
|
"metadata": {"type": "object"},
|
|
"created_at": {"type": "string"}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
response = client.create_memory_export(schema=schema, filters={})
|
|
export_id = response["id"]
|
|
|
|
# Wait and retrieve
|
|
print("Exporting memories...")
|
|
time.sleep(5)
|
|
export_data = client.get_memory_export(memory_export_id=export_id)
|
|
|
|
# Save to file
|
|
with open("mem0_export.json", "w") as f:
|
|
json.dump(export_data, f, indent=2)
|
|
|
|
print(f"Exported {len(export_data['memories'])} memories")
|
|
```
|
|
</Step>
|
|
|
|
<Step title="Set up Supermemory">
|
|
Create your Supermemory account and get your API key:
|
|
|
|
1. Sign up at [console.supermemory.ai](https://console.supermemory.ai)
|
|
2. Create a new project
|
|
3. Generate an API key from the dashboard
|
|
|
|
```bash
|
|
# Set your environment variable
|
|
export SUPERMEMORY_API_KEY="your_supermemory_api_key"
|
|
```
|
|
</Step>
|
|
|
|
<Step title="Import to Supermemory">
|
|
Simple script to import your Mem0 memories into Supermemory:
|
|
|
|
```python
|
|
import json
|
|
from supermemory import Supermemory
|
|
|
|
# Load your Mem0 export
|
|
with open("mem0_export.json", "r") as f:
|
|
mem0_data = json.load(f)
|
|
|
|
# Connect to Supermemory
|
|
client = Supermemory(api_key="your_supermemory_api_key")
|
|
|
|
# Import memories
|
|
for memory in mem0_data["memories"]:
|
|
content = memory.get("content", "")
|
|
|
|
# Skip empty memories
|
|
if not content:
|
|
continue
|
|
|
|
# Import to Supermemory
|
|
try:
|
|
result = client.add(
|
|
"imported_from_mem0",
|
|
content=content,
|
|
metadata={
|
|
"source": "mem0",
|
|
"created_at": memory.get("created_at"),
|
|
**(memory.get("metadata") or {})
|
|
}
|
|
)
|
|
print(f"Imported: {content[:50]}...")
|
|
except Exception as e:
|
|
print(f"Failed: {e}")
|
|
|
|
print("Migration complete!")
|
|
```
|
|
</Step>
|
|
</Steps>
|
|
|
|
## API migration reference
|
|
|
|
Here's how common Mem0 operations map to Supermemory:
|
|
|
|
### Adding memories
|
|
|
|
<CodeGroup>
|
|
|
|
```python mem0
|
|
from mem0 import MemoryClient
|
|
|
|
client = MemoryClient(api_key="...")
|
|
client.add(
|
|
messages="User prefers dark mode",
|
|
user_id="alice"
|
|
)
|
|
```
|
|
|
|
```typescript Supermemory
|
|
import { Supermemory } from "supermemory";
|
|
|
|
const client = new Supermemory({ apiKey: "..." });
|
|
await client.add("user_alice", {
|
|
content: "User prefers dark mode",
|
|
});
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
### Searching memories
|
|
|
|
<CodeGroup>
|
|
|
|
```python Mem0
|
|
results = client.search(
|
|
query="user preferences",
|
|
user_id="alice"
|
|
)
|
|
```
|
|
|
|
```typescript Supermemory
|
|
const { results } = await client.search("user_alice", {
|
|
query: "user preferences",
|
|
searchMode: "memories",
|
|
});
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
### Getting all memories
|
|
|
|
<CodeGroup>
|
|
|
|
```python Mem0
|
|
memories = client.get_all(
|
|
user_id="alice"
|
|
)
|
|
```
|
|
|
|
```typescript Supermemory
|
|
const { memories } = await client.list("user_alice", "memories", {
|
|
limit: 100,
|
|
});
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
### Deleting memories
|
|
|
|
<CodeGroup>
|
|
|
|
```python Mem0
|
|
client.delete(memory_id="mem_123")
|
|
```
|
|
|
|
```typescript Supermemory
|
|
await client.documents.delete("user_alice", {
|
|
ids: ["mem_123"],
|
|
});
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
<Note>
|
|
For enterprise migrations, [contact us](mailto:support@supermemory.ai) for assistance.
|
|
</Note>
|
|
|
|
## Next steps
|
|
|
|
1. [Explore](/concepts/how-it-works) how Supermemory works
|
|
2. Read the [quickstart](/quickstart) and add and retrieve your first memories
|
|
3. [Connect](/connectors/overview) to Google Drive, Notion, and OneDrive with automatic syncing
|