---
title: "Getting Started"
description: "Mem0 (\"mem-zero\") is an intelligent memory layer designed to enhance AI assistants and agents by enabling personalized interactions. It allows AI systems to remember user preferences, adapt to indi..."
last_updated: "2026-05-07T04:45:15.600779+00:00"
canonical_url: "https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/technical/section-1/getting-started"
---

<details>
<summary>Relevant source files</summary>

The following files were used as context for generating this wiki page:

- [README.md](https://github.com/blade47/mem0/blob/main/README.md)
</details>

Mem0 ("mem-zero") is an intelligent memory layer designed to enhance AI assistants and agents by enabling personalized interactions. It allows AI systems to remember user preferences, adapt to individual needs, and continuously learn over time. This capability is particularly useful for applications such as customer support chatbots, AI assistants, and autonomous systems that require consistent, context-rich conversations.

Mem0 offers significant performance improvements, including +26% accuracy over OpenAI Memory on the LOCOMO benchmark, 91% faster responses, and 90% lower token usage, leading to reduced costs without compromising quality.
Sources: [README.md:16-17](https://github.com/blade47/mem0/blob/main/README.md#L16-L17), [README.md:32-37](https://github.com/blade47/mem0/blob/main/README.md#L32-L37), [README.md:41-46](https://github.com/blade47/mem0/blob/main/README.md#L41-L46)

## Key Features & Use Cases

Mem0 provides core capabilities and is applicable across various domains:

### Core Capabilities
*   **Multi-Level Memory**: Seamlessly retains User, Session, and Agent state with adaptive personalization.
*   **Developer-Friendly**: Offers an intuitive API, cross-platform SDKs, and a fully managed service option.

### Applications
*   **AI Assistants**: Facilitates consistent, context-rich conversations.
*   **Customer Support**: Enables recalling past tickets and user history for tailored assistance.
*   **Healthcare**: Helps track patient preferences and history for personalized care.
*   **Productivity & Gaming**: Supports adaptive workflows and environments based on user behavior.
Sources: [README.md:50-61](https://github.com/blade47/mem0/blob/main/README.md#L50-L61)

## Quickstart Guide

To get started with Mem0, you can choose between a hosted platform or a self-hosted open-source package.

### Hosted Platform

The hosted platform provides automatic updates, analytics, and enterprise security, allowing for quick setup.

<Steps>
<Step>
### Sign up on Mem0 Platform
Register for an account on the [Mem0 Platform](https://app.mem0.ai).
</Step>
<Step>
### Embed the memory layer
Integrate the memory layer into your application using the provided SDKs or API keys.
</Step>
</Steps>
Sources: [README.md:67-71](https://github.com/blade47/mem0/blob/main/README.md#L67-L71)

### Self-Hosted (Open Source)

For self-hosting, you can install the Mem0 SDK via `pip` for Python or `npm` for JavaScript/TypeScript projects.

<Tabs items={["pip", "npm"]}>
<Tab value="pip">

```bash
pip install mem0ai
```
</Tab>
<Tab value="npm">

```bash
npm install mem0ai
```
</Tab>
</Tabs>
Sources: [README.md:76-82](https://github.com/blade47/mem0/blob/main/README.md#L76-L82)

### Basic Usage

Mem0 requires an LLM to function, with `gpt-4.1-nano-2025-04-14` from OpenAI as the default. It supports a variety of LLMs, which can be configured as needed. The following example demonstrates a basic chat interaction using Mem0 to manage conversation memory.

```python
from openai import OpenAI
from mem0 import Memory

openai_client = OpenAI()
memory = Memory()

def chat_with_memories(message: str, user_id: str = "default_user") -> str:
    # Retrieve relevant memories
    relevant_memories = memory.search(query=message, user_id=user_id, limit=3)
    memories_str = "\n".join(f"- {entry['memory']}" for entry in relevant_memories["results"])

    # Generate Assistant response
    system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}"
    messages = [{"role": "system", "content": system_prompt}, {"role": "user", "content": message}]
    response = openai_client.chat.completions.create(model="gpt-4.1-nano-2025-04-14", messages=messages)
    assistant_response = response.choices[0].message.content

    # Create new memories from the conversation
    messages.append({"role": "assistant", "content": assistant_response})
    memory.add(messages, user_id=user_id)

    return assistant_response

def main():
    print("Chat with AI (type 'exit' to quit)")
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() == 'exit':
            print("Goodbye!")
            break
        print(f"AI: {chat_with_memories(user_input)}")

if __name__ == "__main__":
    main()
```
Sources: [README.md:84-118](https://github.com/blade47/mem0/blob/main/README.md#L84-L118)

#### Basic Usage Flow

The interaction with Mem0 involves a cycle of searching for relevant memories, generating a response using an LLM, and then adding new memories from the conversation.


Sources: [README.md:92-118](https://github.com/blade47/mem0/blob/main/README.md#L92-L118)

#### `chat_with_memories` Sequence

The `chat_with_memories` function orchestrates the interaction between the user, Mem0's memory layer, and the OpenAI LLM.

```mermaid
sequenceDiagram
    actor User
    participant App as chat_with_memories()
    participant Mem0 as Memory()
    participant OpenAI as OpenAI()

    User->>App: message, user_id
    App->>Mem0: search(query=message, user_id, limit=3)
    Mem0-->>App: relevant_memories
    App->>App: Construct system_prompt with memories
    App->>OpenAI: chat.completions.create(model, messages)
    OpenAI-->>App: assistant_response
    App->>App: Append assistant_response to messages
    App->>Mem0: add(messages, user_id)
    Mem0-->>App: Memory added confirmation
    App-->>User: assistant_response
```
Sources: [README.md:92-108](https://github.com/blade47/mem0/blob/main/README.md#L92-L108)

## Integrations & Demos

Mem0 provides several integrations and live demonstrations to showcase its capabilities:

*   **ChatGPT with Memory**: A live demo of personalized chat powered by Mem0.
*   **Browser Extension**: A Chrome Extension to store memories across ChatGPT, Perplexity, and Claude.
*   **Langgraph Support**: A guide on building a customer bot using Langgraph and Mem0.
*   **CrewAI Integration**: An example demonstrating how to tailor CrewAI outputs with Mem0.
Sources: [README.md:122-131](https://github.com/blade47/mem0/blob/main/README.md#L122-L131)

## Documentation & Support

For further details and assistance, refer to the following resources:

*   **Full Documentation**: [https://docs.mem0.ai](https://docs.mem0.ai)
*   **Community**: Join the [Discord](https://mem0.dev/DiG) or follow on [Twitter](https://x.com/mem0ai).
*   **Contact**: Reach out via email at founders@mem0.ai.
Sources: [README.md:135-138](https://github.com/blade47/mem0/blob/main/README.md#L135-L138)

## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/faa36707-7c28-4f69-a18f-700ff61c704e/llms.txt) for all pages in this wiki.
