REST API Server

MemOS provides a REST API server (written using FastAPI). Users can perform all operations through REST endpoints.
Loading...
APIs supported by MemOS REST API Server

Features

  • Register a new user: Register a new user with configuration and default cube.
  • Get suggestion queries: Get suggestion queries for a specific user.
  • Get all memories for user: Get all memories for a specific user.
  • Add a new memory: Create a new memory for a specific user.
  • Search memories: Search memories for a specific user.
  • Chat with MemOS: Chat with MemOS for a specific user. Returns SSE stream.

Running Locally

With Docker Compose

The Development Docker Compose comes pre-configured with postgres pgvector, neo4j and a server/history/history.db volume for the history database.

The only required environment variable to run the server is OPENAI_API_KEY.

Create a .env file in the server/ directory and set your environment variables. For example:

OPENAI_API_KEY=your-openai-api-key

Run the Docker container using Docker Compose:

docker compose up --build

Access the API at http://localhost:8000.

Making changes to the server code or the library code will automatically reload the server.

With Docker

Create a .env file in the current directory and set your environment variables. For example:

OPENAI_API_KEY=your-openai-api-key

Build the docker image locally.

docker build -t memos-api-server .

Run the Docker container:

docker run --env-file .env -p 8000:8000 memos-api-server

Access the API at http://localhost:8000.

Without Docker