This page focuses on environment variables you need to run and tune Postgram.
- Start from
.env.example and populate mandatory values.
- Set server/runtime settings (
DATABASE_URL, PORT, LOG_LEVEL).
- Choose provider settings for embeddings and optional extraction.
- Validate startup and queue behavior with health + search checks.
| Variable | Required | Default | Meaning |
|---|
DATABASE_URL | yes | | Full Postgres connection string. |
OPENAI_API_KEY | conditional | | Required for OpenAI embeddings or OpenAI extraction. |
PORT | no | 3100 | HTTP/MCP server port. |
LOG_LEVEL | no | info | Logger level. |
ENRICHMENT_POLL_INTERVAL_MS | no | 1000 | Enrichment worker polling interval. |
| Variable | Required | Default | Meaning |
|---|
EMBEDDING_PROVIDER | no | openai | 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_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://localhost:11434 | 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.
- Use admin
embeddings migrate when changing vector dimensions after changing
model family.