# Mem0 Memory Storage - PolarDB-X Zero

## Quick Start

To get a free Mem0 memory storage instance:

### Step 1: Request an instance

```bash
curl -s -X POST https://zero.polardbx.com/api/v1/mem0 \
  -H 'Content-Type: application/json' \
  -d '{"tag":"agent-trial"}'
```

Response:
```json
{
  "id": "mem0_xxx",
  "endpoint": "http://xxx.polardbx.rds.aliyuncs.com:8080",
  "apiKey": "your-api-key",
  "region": "cn-hangzhou"
}
```

### Step 2: Use the Mem0 API

Add a memory:
```bash
curl -X POST http://ENDPOINT/v1/memories \
  -H "Authorization: Token API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"I like pizza"}],"user_id":"demo"}'
```

Search memories:
```bash
curl -X POST http://ENDPOINT/v1/memories/search \
  -H "Authorization: Token API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"food preferences","user_id":"demo"}'
```

### Step 3: Python SDK (optional)

```python
from mem0ai import MemoryClient
client = MemoryClient(api_key="API_KEY", host="ENDPOINT")
client.add("I like pizza", user_id="demo")
results = client.search("food preferences", user_id="demo")
print(results)
```

## Notes
- Free trial, no payment required
- API is compatible with mem0ai Python SDK
