# mem0 Self-Hosted - Environment Variables # Copy this file to .env and fill in your values # ============================================================================= # REQUIRED - Must be set before starting # ============================================================================= # PostgreSQL password (required for pgvector/pgvector:pg17) # Generate with: openssl rand -base64 32 POSTGRES_PASSWORD=your-secure-postgres-password-here # OpenAI API Key (required for default LLM and embedder) # Get from: https://platform.openai.com/api-keys OPENAI_API_KEY=sk-your-openai-api-key-here # JWT Secret for authentication (required when AUTH_DISABLED=false) # Generate with: openssl rand -base64 48 JWT_SECRET=your-jwt-secret-here # ============================================================================= # OPTIONAL - Authentication # ============================================================================= # Admin API Key (optional - alternative to dashboard admin registration) # Generate with: openssl rand -base64 32 # If set, use as Bearer token or X-API-Key header for admin access ADMIN_API_KEY= # Disable authentication (local development ONLY - not for production) # AUTH_DISABLED=true # ============================================================================= # OPTIONAL - Model Configuration # ============================================================================= # Default LLM model (must be supported by your API key) MEM0_DEFAULT_LLM_MODEL=gpt-5-mini # Default embedder model MEM0_DEFAULT_EMBEDDER_MODEL=text-embedding-3-small # ============================================================================= # OPTIONAL - Dashboard & API URLs # ============================================================================= # Dashboard URL (used for CORS and redirects) DASHBOARD_URL=http://localhost:7860 # Public API URL (used by dashboard for API calls) NEXT_PUBLIC_API_URL=http://localhost:7860/api # Instance name shown in dashboard NEXT_PUBLIC_INSTANCE_NAME=Mem0 # ============================================================================= # OPTIONAL - Telemetry # ============================================================================= # Disable anonymous telemetry (enabled by default) # MEM0_TELEMETRY=false # ============================================================================= # OPTIONAL - Advanced Configuration # ============================================================================= # PostgreSQL connection (usually don't need to change) POSTGRES_HOST=localhost POSTGRES_PORT=5432 POSTGRES_DB=postgres POSTGRES_USER=mem0 POSTGRES_COLLECTION_NAME=memories # History database path HISTORY_DB_PATH=/opt/data/history/history.db # Sync interval for backup (seconds) SYNC_INTERVAL=60