Docs/ Reference

Environment variables

Process-level configuration is written in .env and requires a restart after changes. This page is a lookup table; you do not need to read it end to end.

Difference from runtime settings §

GPT-Load has two sets of configurations, easy to confuse:

Type Where to change it When it takes effect
Environment variables The .env fileRestart required. Controls the process itself: listen address, database, and keys.
Runtime settings management UI Takes effect immediately. Controls scheduling behavior: timeouts, retries, and affinity.

This page covers the former. See Runtime settings for scheduling parameters.

Process and network §

Variable Default value Explanation
HOST127.0.0.1 Listen address. Changing it to 0.0.0.0 exposes the service; read the Security page first.
PORT3001 Listening port; it must be between 1 and 65,535
READ_TIMEOUT60 Timeout for reading requests, in seconds
IDLE_TIMEOUT120 Connection idle timeout, in seconds.
GRACEFUL_SHUTDOWN_TIMEOUT10 Graceful-shutdown wait time, in seconds
Units for all timeout items are seconds

This is not milliseconds. It is an easy value to misconfigure: entering 60000 produces a 16-hour timeout.

Data and storage §

Variable Default value Explanation
DATA_DIR./data Data directory, stores the database and two keys
DATABASE_DSN (empty) Leave blank to use managed SQLite; fill in to connect to an external database
DATABASE_MAX_OPEN_CONNECTIONS10 Maximum database connections. Applies to MySQL and PostgreSQL only; SQLite always uses a single connection
DATABASE_MAX_IDLE_CONNECTIONS5 Maximum idle connections; must not exceed the previous entry. Also applies to MySQL and PostgreSQL only

See Database and backup for DATABASE_DSN syntax and the tradeoffs among the three drivers.

Key §

Variable Default value Explanation
AUTH_KEY Automatically generated Management UI login key. Leave empty to generate it at DATA_DIR/auth.key.
ENCRYPTION_KEY Automatically generated Encrypts channel credentials. Leave empty to generate it at DATA_DIR/encryption.key. It does not support rotation and must be backed up with the database.

See Security and production for the complete description of both keys.

Outbound proxies §

Variable Default value Explanation
HTTP_PROXY (empty) Environment proxy for HTTP upstream requests
HTTPS_PROXY (empty) Environment proxy for HTTPS upstream requests
NO_PROXY (empty) Comma-separated hosts, domains, or IPs that bypass the environment proxy
They are the last fallback layer

An environment proxy only takes effect when the credential, the Group, and the global settings all leave the proxy unspecified. Once a proxy is configured in the management UI, these variables no longer apply. For the full precedence chain, see Proxy and request headers.

Logs §

Variable Default value Explanation
LOG_LEVELinfo Log level
LOG_FORMATtextAccepts only text or json; use the latter with a log collector.

This refers to Process log (the program's runtime status), not request logs. Configure request-log retention in the management UI.

Model price sync §

Variable Default value Explanation
MODELS_DEV_AUTO_SYNC_ENABLED (unset) Whether to sync model prices from Models.dev automatically. When unset, the management UI's stored setting decides; it starts enabled
Set it, and the toggle in the management UI turns read-only

When this variable is not set, the toggle stays under the management UI and can be changed at any time. Once you set it explicitly in .env to true or false, it becomes a forced value and the option of the same name in the management UI becomes read-only. If you cannot turn auto-sync off in the management UI, check this variable first. For where prices come from, see Model management.

Overrides in the container §

Changing these two items inside the container is useless

With Compose, HOST inside the container is fixed to 0.0.0.0 and DATA_DIR to /app/data. Changing either in .env has no effect.

External reachability is controlled by port-publishing configuration; by default it publishes only on the host's 127.0.0.1:

docker-compose.yml
ports:
  - "$${HOST:-127.0.0.1}:$${PORT:-3001}:$${PORT:-3001}"

In other words, in a container deployment, HOST controls which address is published on the host, not the container's listen address. Use a reverse proxy for external access; see Security and production.

Three more variables only mean something in a Compose deployment; they do nothing when you run the binary directly:

Variable Default value Explanation
BIND_ADDRESS inherits HOST Compose only: sets which host address the main service port publishes to, without affecting the callback ports
OAUTH_CALLBACK_BIND_ADDRESS inherits HOST Compose only: sets the publish address for the three callback ports 1455, 54545, and 51121 on its own
CONTAINER_STOP_GRACE_PERIOD15s Compose only: how long to wait before force-stopping the container, in Docker duration format; should exceed GRACEFUL_SHUTDOWN_TIMEOUT

OAUTH_CALLBACK_BIND_ADDRESS is covered in Subscription accounts — in short: Do not change it to 0.0.0.0 just to complete authorization.

Environment variables - GPT-Load