# Configuration

> Every setting of the gateway, its environment variable and its default.

Applies to: the Sypnia engine (open source, self-hosted).  
Source: https://ai.docs.sypnia.com/self-hosting/configuration/

For agents: Settings (env, prefix SYPNIA_GATEWAY_ to avoid clashing with the Telemetry engine's SYPNIA_AI_*): DATABASE_URL (required), ROOT_TOKEN (required), PUBLIC_URL, PORT (8095), OPENROUTER_KEY, BEDROCK_REGION (+ standard AWS credential chain; BEDROCK_ROLE_ARN optional), PROVIDERS (name=url[;key=…], comma list of OpenAI-compatible endpoints), ZERO_RETENTION_ONLY (true), PRICES (path to price table YAML; default built-in table for OpenRouter/Bedrock refreshed on upgrade), CURRENCY (USD), STORAGE_URL (s3-compatible, optional), CALL_RETENTION_DAYS (90), OTLP_ENDPOINT, OTLP_HEADERS, DATA_JWKS_URL (Sypnia Data engine for browser tokens), FIRST_TOKEN_TIMEOUT_S (20), REQUEST_TIMEOUT_S (600), MAX_BODY_MB (25), AUTO_MIGRATE (false), LOG (info), MCP (true).

Settings are environment variables. They start with `SYPNIA_GATEWAY_`, so they never mix with the Telemetry engine's own `SYPNIA_AI_` settings when both run side by side.

### `SYPNIA_GATEWAY_DATABASE_URL`* **Key:** `database_url`
* **Type:** string
* **Default:** `none (required)`
* \[Engine]Postgres 16 or newer.

### `SYPNIA_GATEWAY_ROOT_TOKEN`* **Key:** `root_token`
* **Type:** string (secret)
* **Default:** `none (required)`
* \[Engine]The token that can do everything: create projects, keys and routes. Keep it in a secret store.

### `SYPNIA_GATEWAY_PUBLIC_URL`* **Key:** `public_url`
* **Type:** URL
* **Default:** `http://localhost:8095`
* \[Engine]The address your apps and agents use.

### `SYPNIA_GATEWAY_PORT`* **Key:** `port`
* **Type:** number
* **Default:** `8095`
* \[Engine]The port the gateway listens on.

### `SYPNIA_GATEWAY_OPENROUTER_KEY`* **Key:** `openrouter_key`
* **Type:** string (secret)
* **Default:** `empty`
* \[Engine]Your OpenRouter key. Empty: OpenRouter is not used.

### `SYPNIA_GATEWAY_BEDROCK_REGION`* **Key:** `bedrock_region`
* **Type:** string
* **Default:** `empty`
* \[Engine]The AWS region of the Bedrock models. Credentials come from the usual AWS chain (environment, profile, instance role); set `SYPNIA_GATEWAY_BEDROCK_ROLE_ARN` to assume a role. Empty: Bedrock is not used.

### `SYPNIA_GATEWAY_PROVIDERS`* **Key:** `providers`
* **Type:** string
* **Default:** `empty`
* \[Engine]OpenAI-compatible endpoints, as `name=url` separated by commas, with `;key=…` when one needs a key: `local=http://models:11434/v1`. In routes they are `<name>/<model>`.

### `SYPNIA_GATEWAY_ZERO_RETENTION_ONLY`* **Key:** `zero_retention_only`
* **Type:** boolean
* **Default:** `true`
* \[Engine]Send OpenRouter requests only to endpoints that keep nothing and train on nothing. Endpoints of your own are not affected.

### `SYPNIA_GATEWAY_PRICES`* **Key:** `prices`
* **Type:** path
* **Default:** `the built-in table`
* \[Engine]A YAML price table, per model, per million tokens read, written and read from cache. The built-in table covers OpenRouter and Bedrock and is updated with every release.

### `SYPNIA_GATEWAY_CURRENCY`* **Key:** `currency`
* **Type:** string
* **Default:** `USD`
* \[Engine]The currency of the price table, used in usage.

### `SYPNIA_GATEWAY_STORAGE_URL`* **Key:** `storage_url`
* **Type:** URL
* **Default:** `empty`
* \[Engine]S3-compatible storage for kept questions and answers and the response cache. Empty: neither is available.

### `SYPNIA_GATEWAY_CALL_RETENTION_DAYS`* **Key:** `call_retention_days`
* **Type:** number
* **Default:** `90`
* \[Engine]How long call records are kept. Usage totals are kept regardless.

### `SYPNIA_GATEWAY_OTLP_ENDPOINT`* **Key:** `otlp_endpoint`
* **Type:** URL
* **Default:** `empty`
* \[Engine]Where spans go: Sypnia Telemetry, or any OpenTelemetry endpoint. Add headers with `SYPNIA_GATEWAY_OTLP_HEADERS` (`name=value`, separated by commas).

### `SYPNIA_GATEWAY_DATA_JWKS_URL`* **Key:** `data_jwks_url`
* **Type:** URL
* **Default:** `empty`
* \[Engine]Your Sypnia Data engine's published keys, to accept people's sessions for browser tokens. Empty: only your server can create browser tokens.

### `SYPNIA_GATEWAY_FIRST_TOKEN_TIMEOUT_S`* **Key:** `first_token_timeout_s`
* **Type:** number
* **Default:** `20`
* \[Engine]How long to wait for a model's first token before trying the next model.

### `SYPNIA_GATEWAY_REQUEST_TIMEOUT_S`* **Key:** `request_timeout_s`
* **Type:** number
* **Default:** `600`
* \[Engine]The longest a call may take, streams included.

### `SYPNIA_GATEWAY_MAX_BODY_MB`* **Key:** `max_body_mb`
* **Type:** number
* **Default:** `25`
* \[Engine]The largest request body.

### `SYPNIA_GATEWAY_AUTO_MIGRATE`* **Key:** `auto_migrate`
* **Type:** boolean
* **Default:** `false`
* \[Engine]Apply database migrations on start.

### `SYPNIA_GATEWAY_MCP`* **Key:** `mcp`
* **Type:** boolean
* **Default:** `true`
* \[Engine]Serve the MCP server at `/mcp`.

### `SYPNIA_GATEWAY_LOG`* **Key:** `log`
* **Type:** string
* **Default:** `info`
* \[Engine]`error`, `warn`, `info` or `debug`. No level ever logs what was asked or answered.
