This page focuses on environment variables you need to run and tune Postgram.
- For Docker Compose, choose the embedding provider before the first start.
Compose generates and persists PostgreSQL and Admin installation secrets.
- Add a real
OPENAI_API_KEY in .env only when choosing hosted OpenAI
embeddings; otherwise run Ollama on the Docker host for the local path.
- Set server/runtime overrides only when your deployment needs them.
- Validate startup and queue behavior with health + search checks.
| Variable | Required | Default | Meaning |
|---|
DATABASE_URL | non-Compose or external Postgres | | Full Postgres connection string. Default Compose creates its own Postgres connection. |
OPENAI_API_KEY | conditional | | Required for OpenAI embeddings or OpenAI extraction. |
PORT | no | 3100 | HTTP/MCP server port. |
OAUTH_ENABLED | no | false | Enable OAuth authorization-code, PKCE, and Dynamic Client Registration routes for native remote MCP connectors. |
PUBLIC_BASE_URL | when OAuth enabled | | Public HTTPS origin for OAuth metadata and callback URLs. Example: https://postgram.example.com. |
LOG_LEVEL | no | info | Logger level. |
ENRICHMENT_POLL_INTERVAL_MS | no | 1000 | Enrichment worker polling interval. |
| Variable | Required | Default | Meaning |
|---|
EMBEDDING_PROVIDER | no | Compose chooses openai with OPENAI_API_KEY, otherwise ollama | openai or ollama. |
EMBEDDING_MODEL | no | provider-default | Embedding model name. |
EMBEDDING_DIMENSIONS | no | provider-default | Must match active embedding model. |
EMBEDDING_BASE_URL | conditionally | OLLAMA_BASE_URL fallback | For Ollama host. |
EMBEDDING_API_KEY | no | | Optional bearer token. |
For Docker + Ollama on the host, use EMBEDDING_BASE_URL=http://host.docker.internal:11434.
| Variable | Required | Default | Meaning |
|---|
EXTRACTION_ENABLED | no | false | Enable extraction pass. |
EXTRACTION_MEMORY_MODE | no | embed_only | embed_only keeps memories searchable without graph/entity extraction; extract_durable extracts durable memories; extract_all extracts durable memories and session context. |
EXTRACTION_PROVIDER | no | openai | openai, anthropic, ollama, openai-compatible. |
EXTRACTION_MODEL | no | provider-default | LLM model name for extraction. |
EXTRACTION_BASE_URL | when provider-compatible | | Base URL for compatible OpenAI-compatible API. |
EXTRACTION_API_KEY | no | | Optional bearer token for extraction API. |
ANTHROPIC_API_KEY | conditionally | | Required for Anthropic provider. |
OLLAMA_BASE_URL | no | http://host.docker.internal:11434 in Compose | Base URL for Ollama extraction. |
| Variable | Required | Purpose |
|---|
PGM_API_URL | yes | pgm server URL. |
PGM_API_KEY | yes | pgm authentication token. |
DATABASE_URL or PGM_DATABASE_URL | yes (admin) | DB access for admin commands. |
PGM_BACKUP_PASSPHRASE | when encrypted backup | GPG passphrase. |
EXTRACTION_AUTO_CREATE_ENTITIES and semantic-neighbor settings allow
relationship densification without re-processing everything manually.
- Memory graph extraction is opt-in. Leave
EXTRACTION_MEMORY_MODE=embed_only
unless your deployment intentionally wants memory-derived graph edges.
- Use admin
embeddings migrate when changing vector dimensions after changing
model family.
PUBLIC_BASE_URL is the public origin only. Do not include /mcp; connector
URLs use ${PUBLIC_BASE_URL}/mcp.