Skip to content

Environment Variables ​

Core ​

VariableRequiredPurpose
LITELLM_MASTER_KEYYesMaster key of the LiteLLM proxy.
GATEWAY_ADMIN_KEYYesProtects /admin/v1. Without it the admin API answers 503.
DATABASE_URLFor virtual keysPostgreSQL connection string.
GATEWAY_DATABASE_URLNoDatabase for the gateway's own tables, when different from DATABASE_URL.
REDIS_PASSWORDNoPassword for the shared Redis cache (may be empty).
GATEWAY_POLICY_FILENoPath to policy.yaml (set for you by LLMGateway).
GATEWAY_DEFAULT_MODELNoModel used by /v1/invoke when none is given.
GATEWAY_AUTO_ALIASNoName of the virtual routing alias (default auto).
GATEWAY_TEMPLATES_DIRNoExtra directory of guardrail templates; wins over built-ins with the same id.

Cache ​

VariablePurpose
GATEWAY_CACHE_SCOPEWho may share cache entries: team (default), global, org, domain or key.
GATEWAY_CACHE_DEFAULT_TTLTTL used when no policy sets one.

Alerts ​

VariablePurpose
GATEWAY_ALERT_WEBHOOK_URLBudget alerts are always logged; when set, they are also posted here as JSON with a Slack-compatible text field.

Edge lockdown ​

See Security and Deployment.

VariablePurpose
GATEWAY_LOCKDOWNoff disables the deny-by-default edge (development only).
GATEWAY_ENABLE_DOCStrue exposes /docs, /redoc, /openapi.json.
GATEWAY_ENABLE_METRICStrue exposes /metrics.
GATEWAY_EXTRA_ALLOWED_PREFIXESComma-separated extra route prefixes to allow.

AWS Secrets Manager ​

Secrets are loaded once at start-up, before LiteLLM or the gateway read the environment, so provider keys, the master and admin keys, DATABASE_URL and the alert webhook can all come from Secrets Manager with no other change. With neither of the first two variables set, AWS is never contacted.

VariablePurpose
GATEWAY_AWS_SECRETSComma-separated secret ids or ARNs, each a JSON object {"VAR": "value"}. Every key becomes an environment variable.
GATEWAY_AWS_SECRET_VARSComma-separated NAME=secret-id (whole secret is the value) or NAME=secret-id#json-key (one field). Applied after GATEWAY_AWS_SECRETS, so it wins.
GATEWAY_AWS_SECRETS_REGIONRegion of the secrets. Default: AWS_REGION, AWS_DEFAULT_REGION or AWS_REGION_NAME.
GATEWAY_AWS_SECRETS_ENDPOINTCustom endpoint (LocalStack or moto for testing).
GATEWAY_AWS_SECRETS_OVERRIDEtrue: a secret replaces a variable that is already set. Default false: the environment wins.
GATEWAY_AWS_SECRETS_REQUIREDDefault true: refuse to start if a secret cannot be read. false: log it and carry on.

AWS credentials come from the standard chain (IAM role, or AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY). Values are never logged; only variable names and where they came from.

bash
export GATEWAY_AWS_SECRETS="prod/llm-gateway/core"
export GATEWAY_AWS_SECRET_VARS="AZURE_OPENAI_API_KEY=prod/llm-gateway/azure#api_key"

Container start-up ​

The elsai-llm-gateway command and python -m elsai_llm_gateway.bootstrap load secrets, check the essentials, then hand over to LiteLLM through the entrypoint in GATEWAY_ENTRYPOINT (default /app/docker/prod_entrypoint.sh). If a required value is missing it stops and names it.

Copyright © 2026 elsai foundry.