docs/open-source/python-quickstart.mdx
Get started with Mem0's Python SDK in under 5 minutes. This guide shows you how to install Mem0 and store your first memory.
Set your OpenAI API key:
export OPENAI_API_KEY="your-openai-api-key"
m = Memory()
</Step>
<Step title="Add a memory">
```python
messages = [
{"role": "user", "content": "Hi, I'm Alex. I love basketball and gaming."},
{"role": "assistant", "content": "Hey Alex! I'll remember your interests."}
]
m.add(messages, user_id="alex")
Output:
{
"results": [
{
"id": "mem_123abc",
"memory": "Name is Alex. Enjoys basketball and gaming.",
"user_id": "alex",
"categories": ["personal_info"],
"created_at": "2025-10-22T04:40:22.864647-07:00",
"score": 0.89
}
]
}