Skip to content
Allay AI

WikiAllay Server

Environment variables

The environment holds only what the backend can't start without. Everything else – keys, models, limits – is a setting in the admin panel.

#Required

Variable What it does
MONGODB_URI Where MongoDB lives, like mongodb://user:password@allay-mongo:27017/?authSource=admin. The backend won't start without it
MONGODB_DATABASE The database's name, like allay. The backend won't start without it
Variable What it does Default
SELFHOSTED 1 turns billing off: your plugins run on this backend's key, and /allay init sets up the panel. See Who pays for the model unset, so billing is on
PLUGIN_TOKEN Self-hosted: the token every plugin sends as server.token, at least 24 characters. Without it the backend answers no plugin. A setting too, but /allay init needs it before the panel exists unset
SECRETS_KEY Any string. It seals the secrets you save in the panel (keys, the bot token) with AES-GCM, keys the players' pseudonyms in the statistics, and since 6.9 seals players' data: memories, deaths, state, sessions, and traces' words. Keep it safe and never change it: a new key opens none of what was sealed before unset: the backend makes a key in /data/secrets.key
PUBLIC_URL The address people open in a browser, with any path prefix. A setting, but set it here on the first start so the setup link points to your backend API_URL, which is https://allay.chat

Without SECRETS_KEY, mount /data as a volume. Otherwise the key file dies with the container, and the secrets saved in the panel and every player's sealed data die with it.

#Optional

Variable What it does Default
PORT The port to listen on 3000
HOST The address to listen on inside the container. Publish the port on 127.0.0.1 instead of changing it 0.0.0.0
SECRETS_KEY_FILE Where the key file lives when SECRETS_KEY is unset /data/secrets.key
ADMIN_USERNAME with ADMIN_PASSWORD or ADMIN_PASSWORD_HASH An owner account defined here. It turns setup off, and the panel can't change it. ADMIN_PASSWORD_HASH is an argon2id hash from Bun.password unset
APP_VERSION The version /api/health reports. The image build sets it dev
TZ The time zone of the logs UTC

#Telemetry

OpenTelemetry's standard variables, read once at start. Nothing is sent while they're unset. Telemetry explains what goes out and has a compose file with Grafana.

Variable What it does Default
OTEL_EXPORTER_OTLP_ENDPOINT Where traces, metrics, and events go over OTLP (http/protobuf), like http://collector:4318 unset: no telemetry
OTEL_EXPORTER_OTLP_HEADERS Headers for the collector, like Authorization=Basic%20… unset
OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER, OTEL_LOGS_EXPORTER otlp or none per signal. Metrics may also be prometheus otlp with an endpoint
OTEL_EXPORTER_PROMETHEUS_PORT The port Prometheus scrapes with OTEL_METRICS_EXPORTER=prometheus 9464
OTEL_METRIC_EXPORT_INTERVAL How often metrics go out, in milliseconds 60000
OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG Which runs are traced, like traceidratio and 0.25 every run
OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES The service's name and attributes, like service.instance.id=my-backend allay-server
OTEL_LOG_CONTENT 1 adds questions, answers, and tool data to traces and events. Self-hosted backends only (SELFHOSTED=1) unset
OTEL_SDK_DISABLED true turns telemetry off whatever else is set unset

#Settings in the environment

Any setting from the settings table can also come from a variable of the same name, such as OPENROUTER_API_KEY. A variable that is set wins and locks its field in the panel (“set by the environment”), so deployments from before 5.7 keep working. Import from the environment in the panel copies those values into MongoDB. After that, remove the variables.

The old SYSTEM_MESSAGE* variables are no longer read: the prompts ship inside the build.

Next: Admin panel and settings