> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment variables

> Reference for the environment variables each Observatory service reads.

Each Observatory service reads its configuration from environment variables. This page lists the variables grouped by service. Defaults shown are what the standard Docker Compose stack uses.

***

## Observatory API

### Database

| Environment Variable            | Description               | Default Value         | Component       |
| ------------------------------- | ------------------------- | --------------------- | --------------- |
| `POSTGRES_OBSERVATORY_URI`      | PostgreSQL host and port. | `observatory-db:5432` | observatory-api |
| `POSTGRES_OBSERVATORY_DATABASE` | Database name.            | `observatory`         | observatory-api |
| `POSTGRES_OBSERVATORY_USERNAME` | Database username.        | `observatory`         | observatory-api |
| `POSTGRES_OBSERVATORY_PASSWORD` | Database password.        | `S3cret`              | observatory-api |

### Authentication (Keycloak)

| Environment Variable              | Description                       | Default Value                 | Component       |
| --------------------------------- | --------------------------------- | ----------------------------- | --------------- |
| `SECURITY_OAUTH2_BASE_SERVER_URL` | Base URL of the auth server.      | *(set per env)*               | observatory-api |
| `SECURITY_OAUTH2_REALM`           | Realm name (the organization ID). | *(set per env)*               | observatory-api |
| `SECURITY_OAUTH2_CLIENT_ID`       | OAuth2 client ID.                 | `flowx-platform-authenticate` | observatory-api |
| `SECURITY_OAUTH2_CLIENT_SECRET`   | Client secret.                    | *(set per env)*               | observatory-api |

<Info>
  Observatory authenticates against an external FlowX identity provider — the platform does not bundle its own Keycloak. Point these at your auth server; the realm is your organization ID.
</Info>

### LLM providers

| Environment Variable | Description        | Default Value                       | Component       |
| -------------------- | ------------------ | ----------------------------------- | --------------- |
| `OPENAI_API_KEY`     | OpenAI API key.    | *(required for OpenAI)*             | observatory-api |
| `ANTHROPIC_API_KEY`  | Anthropic API key. | *(optional)*                        | observatory-api |
| `GOOGLE_API_KEY`     | Google API key.    | *(optional)*                        | observatory-api |
| `XAI_API_KEY`        | xAI API key.       | *(optional)*                        | observatory-api |
| `MISTRAL_API_KEY`    | Mistral API key.   | *(optional)*                        | observatory-api |
| `OLLAMA_BASE_URL`    | Local Ollama URL.  | `http://host.docker.internal:11434` | observatory-api |

### Operational

| Environment Variable            | Description                                   | Default Value     | Component       |
| ------------------------------- | --------------------------------------------- | ----------------- | --------------- |
| `URL_PREFIX`                    | Path prefix the API is served under.          | `/ai-observatory` | observatory-api |
| `CACHE_SIZE`                    | In-memory cache size (entries).               | `1000`            | observatory-api |
| `CACHE_TTL`                     | Cache TTL in seconds.                         | `3600`            | observatory-api |
| `GUNICORN_WORKERS`              | Worker processes.                             | `1`               | observatory-api |
| `GUNICORN_TIMEOUT`              | Worker timeout in seconds.                    | `600`             | observatory-api |
| `APPLICATION_CORS_ALLOW_ORIGIN` | Comma-separated list of allowed CORS origins. | *(set per env)*   | observatory-api |

***

## Observatory Web

| Environment Variable    | Description                            | Default Value                         | Component       |
| ----------------------- | -------------------------------------- | ------------------------------------- | --------------- |
| `BASE_API_URL`          | Base URL of `observatory-api`.         | `http://localhost:8091`               | observatory-web |
| `PLATFORM_API_URL`      | Base URL of `observatory-platform`.    | `http://localhost:8092`               | observatory-web |
| `KEYCLOAK_ISSUER`       | OIDC issuer URL (auth server + realm). | *(set per env)*                       | observatory-web |
| `KEYCLOAK_REDIRECT_URI` | Post-login redirect.                   | `http://localhost:4900`               | observatory-web |
| `KEYCLOAK_CLIENT_ID`    | Public client ID.                      | `flowx-platform-authenticate`         | observatory-web |
| `KEYCLOAK_SCOPES`       | OAuth2 scopes.                         | `openid profile email offline_access` | observatory-web |

***

## Observatory Platform

| Environment Variable | Description                                   | Default Value   | Component            |
| -------------------- | --------------------------------------------- | --------------- | -------------------- |
| `LOG_LEVEL`          | Logger level.                                 | `INFO`          | observatory-platform |
| `PROMETHEUS_ENABLED` | Toggle Prometheus metrics.                    | `false`         | observatory-platform |
| `ALLOWED_ORIGINS`    | Comma-separated list of allowed CORS origins. | *(set per env)* | observatory-platform |

***

## Observatory SDK

Set these in the environment of the app that uses the SDK — not on the platform itself:

| Environment Variable             | Description                                 | Default Value |
| -------------------------------- | ------------------------------------------- | ------------- |
| `FLOWX_OBSERVATORY_API_KEY`      | API key from the Observatory Home page.     | *(required)*  |
| `FLOWX_OBSERVATORY_API_URL`      | Base URL of the Observatory API.            | *(required)*  |
| `FLOWX_OBSERVATORY_ORG_ID`       | Organization ID.                            | *(required)*  |
| `FLOWX_OBSERVATORY_WORKSPACE_ID` | Workspace ID.                               | *(required)*  |
| `FLOWX_OBSERVATORY_APP_ID`       | Project ID.                                 | *(required)*  |
| `OBSERVATORY_TRACING`            | Set to `false` to turn off instrumentation. | `true`        |

***

## PostgreSQL initialization

The default database setup creates these databases via `init_dbs/multiple-databases.sh` (`POSTGRES_MULTIPLE_DATABASES`):

* `observatory` — the main API store
* `dip`, `writer`, `agent_history`, `builder`, `insights`, `maildb` — companion services in the FlowX AI stack

Default local credentials: `observatory` / `S3cret`. Override via the `POSTGRES_OBSERVATORY_*` env vars in production.

***

## Related resources

<CardGroup cols={2}>
  <Card title="Self-hosted setup" icon="wrench" href="./self-hosted">
    The Compose flow that consumes these variables.
  </Card>

  <Card title="SDK overview" icon="code" href="../sdk/overview">
    SDK-side environment configuration.
  </Card>
</CardGroup>
