Memory
The platform includes semantic memory powered by Mem0, allowing conversations to remember information across sessions. Memories are per-user and can be searched, managed, and automatically injected into conversation context.
How Memory Works
Memories are facts, preferences, and context extracted from conversations and stored in a vector database. When a new message is sent, relevant memories can be retrieved and included in the LLM's context, giving the AI long-term recall.
Searching Memories
Search across a user's memories using natural language. Results are ranked by semantic similarity.
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/search-memories \
-H "X-API-Key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"query": "dietary preferences"
}'
Response:
{
"memories": [
{
"id": "mem_abc123",
"memory": "User is vegetarian and avoids gluten",
"score": 0.92,
"created_at": "2025-02-15T10:00:00Z",
"updated_at": "2025-02-15T10:00:00Z"
},
{
"id": "mem_def456",
"memory": "User prefers meals under 500 calories",
"score": 0.85,
"created_at": "2025-02-20T14:30:00Z",
"updated_at": "2025-02-20T14:30:00Z"
}
]
}
Listing Memories
List all memories for the authenticated user (paginated):
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/list-memories \
-H "X-API-Key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
Getting a Specific Memory
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/get-memory \
-H "X-API-Key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"memory_id": "mem_abc123"
}'
Updating a Memory
Correct or refine an existing memory:
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/update-memory \
-H "X-API-Key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"memory_id": "mem_abc123",
"memory": "User is vegetarian, avoids gluten, and prefers organic produce"
}'
Deleting Memories
Delete a Single Memory
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/delete-memory \
-H "X-API-Key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"memory_id": "mem_abc123"
}'
Delete All Memories
This permanently deletes all memories for the user. This action cannot be undone.
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/delete-all-memories \
-H "X-API-Key: sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{}'
Memory and Conversations
Memories integrate with conversations in two ways:
-
Automatic retrieval — When a message is sent, the platform can search for relevant memories and include them in the LLM's context, giving it awareness of past interactions.
-
MCP tool access — Memory operations are exposed as MCP tools, allowing the LLM to search, create, and update memories during a conversation.
User Impersonation
When using API keys with the users:impersonate scope, memory operations act on the impersonated user's memories:
curl -X POST https://api.yocaso.dev/api/v1/llm/gateway/search-memories \
-H "X-API-Key: sk_live_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"query": "exercise habits"
}'
Related
- Conversations Guide — How memories integrate with conversations
- MCP Tools Guide — Memory as MCP tools
- LLM Gateway API Reference — Full endpoint reference