Skip to content

Configuration

This page focuses on environment variables you need to run and tune Postgram.

  1. For Docker Compose, choose the embedding provider before the first start. Compose generates and persists PostgreSQL and Admin installation secrets.
  2. 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.
  3. Set server/runtime overrides only when your deployment needs them.
  4. Validate startup and queue behavior with health + search checks.
VariableRequiredDefaultMeaning
DATABASE_URLnon-Compose or external PostgresFull Postgres connection string. Default Compose creates its own Postgres connection.
OPENAI_API_KEYconditionalRequired for OpenAI embeddings or OpenAI extraction.
PORTno3100HTTP/MCP server port.
OAUTH_ENABLEDnofalseEnable OAuth authorization-code, PKCE, and Dynamic Client Registration routes for native remote MCP connectors.
PUBLIC_BASE_URLwhen OAuth enabledPublic HTTPS origin for OAuth metadata and callback URLs. Example: https://postgram.example.com.
LOG_LEVELnoinfoLogger level.
ENRICHMENT_POLL_INTERVAL_MSno1000Enrichment worker polling interval.
VariableRequiredDefaultMeaning
EMBEDDING_PROVIDERnoCompose chooses openai with OPENAI_API_KEY, otherwise ollamaopenai or ollama.
EMBEDDING_MODELnoprovider-defaultEmbedding model name.
EMBEDDING_DIMENSIONSnoprovider-defaultMust match active embedding model.
EMBEDDING_BASE_URLconditionallyOLLAMA_BASE_URL fallbackFor Ollama host.
EMBEDDING_API_KEYnoOptional bearer token.

For Docker + Ollama on the host, use EMBEDDING_BASE_URL=http://host.docker.internal:11434.

VariableRequiredDefaultMeaning
EXTRACTION_ENABLEDnofalseEnable extraction pass.
EXTRACTION_MEMORY_MODEnoembed_onlyembed_only keeps memories searchable without graph/entity extraction; extract_durable extracts durable memories; extract_all extracts durable memories and session context.
EXTRACTION_PROVIDERnoopenaiopenai, anthropic, ollama, openai-compatible.
EXTRACTION_MODELnoprovider-defaultLLM model name for extraction.
EXTRACTION_BASE_URLwhen provider-compatibleBase URL for compatible OpenAI-compatible API.
EXTRACTION_API_KEYnoOptional bearer token for extraction API.
ANTHROPIC_API_KEYconditionallyRequired for Anthropic provider.
OLLAMA_BASE_URLnohttp://host.docker.internal:11434 in ComposeBase URL for Ollama extraction.
VariableRequiredPurpose
PGM_API_URLyespgm server URL.
PGM_API_KEYyespgm authentication token.
DATABASE_URL or PGM_DATABASE_URLyes (admin)DB access for admin commands.
PGM_BACKUP_PASSPHRASEwhen encrypted backupGPG 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.