> ## 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.

# Install and configure the openmem Python SDK

> Install openmem, select extras for your backend, configure credentials, and connect Memory to Postgres, Mem0, Supermemory, Letta, or a native OMP server.

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.

<CodeGroup>
  ```bash Core only theme={null}
  pip install openmem
  ```

  ```bash With Mem0 theme={null}
  pip install 'openmem[mem0]'
  ```

  ```bash With Supermemory theme={null}
  pip install 'openmem[supermemory]'
  ```

  ```bash With Letta theme={null}
  pip install 'openmem[letta]'
  ```

  ```bash Async support theme={null}
  pip install 'openmem[async]'
  ```

  ```bash HTTP server theme={null}
  pip install 'openmem[server]'
  ```

  ```bash OpenAI embedder theme={null}
  pip install 'openmem[openai]'
  ```
</CodeGroup>

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

| Variable         | Required                                 | Description                                                            |
| ---------------- | ---------------------------------------- | ---------------------------------------------------------------------- |
| `PG_URL`         | When using `provider="postgres"`         | Postgres connection string, e.g. `postgresql://user:pass@host:5432/db` |
| `OPENAI_API_KEY` | Only when instantiating `OpenAIEmbedder` | API 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.

<CodeGroup>
  ```python Postgres theme={null}
  from openmem import Memory

  mem = Memory(provider="postgres", url="postgresql://user:pass@localhost:5432/db")
  ```

  ```python Mem0 theme={null}
  from openmem import Memory

  mem = Memory(provider="mem0", api_key="your-mem0-api-key")
  ```

  ```python Supermemory theme={null}
  from openmem import Memory

  mem = Memory(provider="supermemory", api_key="your-supermemory-api-key")
  ```

  ```python Letta theme={null}
  from openmem import Memory

  mem = Memory(provider="letta", api_key="your-letta-api-key")
  ```

  ```python Native OMP server (passthrough) theme={null}
  from openmem import Memory

  mem = Memory(provider="passthrough", base_url="http://your-omp-server:8080", api_key="optional-key")
  ```
</CodeGroup>

<Note>
  **Automatic adapter selection**

  When 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.
</Note>

<Tip>
  See [Switch providers](/guides/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.
</Tip>
