Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.openmem.blog/llms.txt

Use this file to discover all available pages before exploring further.

The openmem package is split into a small core and optional extras so you only install what your chosen provider requires. This page covers installation options, required environment variables, and how to instantiate Memory for each supported backend.

Requirements

Python 3.11 or later is required. The core package has no platform-specific dependencies on Linux, macOS, or Windows.

Install options

Choose the extras that match your provider. You can combine multiple extras in a single install command.
pip install openmem
The server extra includes async automatically. The openai extra enables OpenAI-powered embeddings for the Postgres adapter — the default offline embedder works without any API key, which is useful for development and testing.

Environment variables

VariableRequiredDescription
PG_URLWhen using provider="postgres"Postgres connection string, e.g. postgresql://user:pass@host:5432/db
OPENAI_API_KEYOnly when instantiating OpenAIEmbedderAPI key for OpenAI embedding calls
You can also pass the connection string and API keys directly as constructor arguments instead of relying on environment variables.

Provider configuration

Instantiate Memory with the provider= argument and any provider-specific keyword arguments.
from openmem import Memory

mem = Memory(provider="postgres", url="postgresql://user:pass@localhost:5432/db")
Automatic adapter selectionWhen you supply base_url=, the SDK probes GET {base_url}/capabilities before resolving the adapter. If the response contains an omp_version field, the SDK uses the passthrough adapter — a thin HTTP client — regardless of the provider= string. This means a provider that has shipped native OMP support is used transparently without any change to your code.
See Switch providers to learn how to move between backends — including how to build a setup where the provider is chosen at runtime from user configuration.