Installation

Get Memori installed and connected to your own database in a few steps.

Want a zero-setup option? Try Memori Cloud at app.memorilabs.ai.

Install Memori

Install Memori
pip install memori

Install Your Database Driver

Memori supports SQLite, PostgreSQL, MySQL, MariaDB, Oracle, MongoDB, CockroachDB, and OceanBase. Managed services like Neon, Supabase, and AWS RDS/Aurora work through their compatible PostgreSQL/MySQL engines. Install the driver for your preferred database:

Database Drivers
# No extra install needed!
# SQLite support is included with Python.

Neon, Supabase, and AWS RDS/Aurora use standard PostgreSQL drivers (psycopg2-binary or psycopg).

Connection Patterns

PatternWhat to pass to connWorks With
SQLAlchemysessionmakerSQLite, PostgreSQL, MySQL, MariaDB, Oracle, CockroachDB, OceanBase
DB API 2.0Function that returns a PEP 249 connectionSQLite and SQL drivers (sqlite3, psycopg2, pymysql, oracledb)
Django ORMDjango connection callableDjango applications
MongoDBFunction that returns a MongoDB database objectMongoDB via pymongo
Database Setup
import sqlite3

def get_connection():
    return sqlite3.connect("memori.db")

from memori import Memori
mem = Memori(conn=get_connection)

Create the Schema

After setting up your connection, run build() once to create the Memori tables in your database. This only needs to be done the first time, or when you upgrade Memori.

import sqlite3
from memori import Memori

def get_connection():
    return sqlite3.connect("memori.db")

mem = Memori(conn=get_connection)
mem.config.storage.build()  # Creates all required tables

Install Your LLM Provider

Install the SDK for your preferred LLM provider:

LLM Provider SDKs
pip install openai

Set Up Your LLM Provider Key

You will need an API key for your LLM provider:

# OpenAI
export OPENAI_API_KEY="your-openai-key"

# Anthropic
export ANTHROPIC_API_KEY="your-anthropic-key"

# Google Gemini
export GOOGLE_API_KEY="your-google-key"

Set Up Your Memori API Key (Optional)

A Memori API key unlocks higher augmentation quotas (5,000/month vs 100 without a key). You can sign up directly from the CLI:

python -m memori sign-up your-email@example.com

Then set the key as an environment variable:

export MEMORI_API_KEY="your-api-key-here"

Or add it to a .env file in your project root:

MEMORI_API_KEY=your-api-key-here

Check your current quota anytime:

python -m memori quota

Pre-download the Embedding Model

Memori uses a local embedding model for semantic search. On first run, it downloads the model automatically, which can take a moment. To pre-download it:

python -m memori setup

Verify Installation

Run pip show memori in your terminal to confirm the package is installed.