Why you need this
GAIA is several apps (API, web, bots) talking to several services (PostgreSQL, MongoDB, Redis, LLM providers, OAuth integrations). Environment variables are how each app finds those services and authenticates with them. If you’re self-hosting or developing locally, this page is the reference for what goes in each.env file and what happens when something is missing.
You rarely need all of them: a minimal local setup needs only the database URLs and auth keys shown in Manual Setup below. Everything else enables a specific feature, skip a key and that feature is disabled, but the app still runs.
GAIA uses Pydantic settings to load environment variables with validation. Settings are defined in apps/api/app/config/settings.py with two modes:
- Development: Most keys optional, missing ones just disable features
- Production: All integration keys required for full functionality
Variables are lazily loaded: the app starts even with missing keys.
Manual Setup
1
Copy environment files
2
Set required variables
At minimum, set these in
apps/api/.env:3
Start development
API Environment Variables
Always Required
These are required in both development and production:Environment & Deployment
Database & Message Queue
When using Docker Compose, these have sensible defaults.
Authentication & OAuth
Computed OAuth callback URLs are generated automatically: -
WORKOS_REDIRECT_URI → {HOST}/api/v1/oauth/workos/callback -
GOOGLE_CALLBACK_URL → {HOST}/api/v1/oauth/google/callback -
COMPOSIO_REDIRECT_URI → {HOST}/api/v1/oauth/composio/callback -
DISCORD_OAUTH_REDIRECT_URI → {HOST}/api/v1/platform-auth/discord/callback -
SLACK_OAUTH_REDIRECT_URI → {HOST}/api/v1/platform-auth/slack/callbackDISCORD_OAUTH_CLIENT_ID and SLACK_OAUTH_CLIENT_ID are optional, without them, users must link their accounts using the /auth bot command instead of the web UI. See Discord Bot and Slack Bot for setup instructions.AI & Machine Learning
Search & Web Content
Media & Content Processing
External Integrations
Memory & Context
GAIA’s memory runs on a self-hosted engine (PostgreSQL + ChromaDB + local embeddings) — no external API keys are required. All variables below are optional and have sensible defaults.Payments
Voice Agent
Monitoring & Analytics
Web Environment Variables
Set these inapps/web/.env:
Full Example
Complete apps/api/.env example
Complete apps/api/.env example
CLI Auto-Discovery
The GAIA CLI can automatically discover and configure environment variables:- Parses
settings.py: Uses Python AST parsing to extract all environment variable definitions - Scans
.env.example: Identifies required variables from example files - Prompts for missing values: Interactive prompts for any undefined variables
- Validates configuration: Ensures all critical variables are properly set
.env file editing and reduces configuration errors.

