> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Mem0

> 在 Mem0 OSS 中将 TokenLab 用作兼容 OpenAI 的 LLM 提供商

## 概述

Mem0 OSS 可以通过其兼容 OpenAI 的 LLM 配置来使用 TokenLab，只需保持 `provider: "openai"` 并设置 `openai_base_url` 即可。

<Note>
  **类型**: 记忆框架 (Memory Framework)

  **主要路径**: 兼容 OpenAI 的 LLM 配置

  **支持置信度**: 支持自定义端点路径
</Note>

## 环境配置

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## Python 配置

```python theme={null}
import os

from mem0 import Memory

config = {
    "llm": {
        "provider": "openai",
        "config": {
            "model": "claude-sonnet-5",
            "api_key": os.environ["TOKENLAB_API_KEY"],
            "openai_base_url": "https://api.tokenlab.sh/v1",
            "temperature": 0.1,
        },
    },
    "vector_store": {
        "provider": "qdrant",
        "config": {"host": "localhost", "port": 6333},
    },
}

memory = Memory.from_config(config)
```

## 基本用法

```python theme={null}
memory.add("The user prefers concise engineering summaries.", user_id="demo")
results = memory.search("How should I answer?", user_id="demo")
print(results)
```

## 端点说明

此配置涵盖了 Mem0 兼容 OpenAI 的 LLM 路径。请根据您使用的向量数据库和嵌入模型单独配置嵌入器 (embedders)。
