Security advisory β€” Malicious litellm versions 1.82.7 and 1.82.8 were removed from PyPI (potential API key exfiltration). Uninstall them, rotate exposed credentials, and upgrade to a safe release (e.g. 1.82.9+). Run pip show litellm to verify. PyPI Β· README

Environment Variable Reference

Grouped by consuming component. βœ… = required, 🟑 = strongly recommended for production/deployment, βšͺ = optional.

Environment Variable Reference

Last updated: 2026-05-21

Template: enterprise/.env.local.example

Grouped by consuming component. βœ… = required, 🟑 = strongly recommended for production/deployment, βšͺ = optional.


1. Shared

VariableRequiredDescription
DATABASE_URLβœ…Postgres connection string; shared by portal / admin / gateway
REDIS_URLβšͺportal/admin currently persist mainly to PG; Redis is started only by local compose
AUTH_JWT_PRIVATE_KEYβœ…RS256 private-key PEM (signed by portal/admin)
AUTH_JWT_PUBLIC_KEYβœ…RS256 public key (verified by gateway)
AUTH_JWT_PRIVATE_KEY_FILEβšͺ.env.local typically uses *_FILE; start-dev.sh expands it to the file contents
AUTH_JWT_PUBLIC_KEY_FILEβšͺSame as above
DEFAULT_TENANT_ID🟑Default tenant ULID (after seed)
DEFAULT_DEPT_IDβšͺDefault department ULID
AGX_AUTO_DB_MIGRATEβšͺstart-dev.sh auto-migrates only against a localhost DB; =0 disables

2. web-portal (:3000)

VariableRequiredDescription
AUTH_DEV_OWNER_PASSWORD🟑 devDev-mode password for owner@agenticx.local
ENABLE_DEV_BOOTSTRAPβšͺAuto-bootstrap seed outside production
GATEWAY_COMPLETIONS_URL🟑Default http://127.0.0.1:8088/v1/chat/completions
NEXT_PUBLIC_SSO_PROVIDERSβšͺid:displayName comma-separated; controls SSO buttons
SSO_<id>_ISSUEROIDCIdP issuer URL
SSO_<id>_CLIENT_IDOIDCOIDC client_id
SSO_<id>_CLIENT_SECRETOIDCOIDC client_secret
SSO_<id>_REDIRECT_URIOIDCCallback URI
SSO_<id>_SCOPESβšͺDefault openid profile email
SSO_<id>_SAML_ENTRY_POINTSAMLSAML IdP SSO URL
SSO_<id>_SAML_ISSUERSAMLSP entityID
SSO_<id>_SAML_CERTSAMLIdP public certificate

Full SSO variables: runbooks/sso-oidc-setup.md and runbooks/sso-saml-setup.md.


3. admin-console (:3001)

VariableRequiredDescription
ADMIN_CONSOLE_LOGIN_EMAIL🟑Admin-console account; default admin@agenticx.local
ADMIN_CONSOLE_LOGIN_PASSWORDβœ…Admin-console password login
ADMIN_CONSOLE_SESSION_SECRETβœ…Admin-console session signing
GATEWAY_BASE_URL🟑Admin-console health-check target (default http://127.0.0.1:8088)
GATEWAY_INTERNAL_TOKENβœ… Vercel splitBearer token Gateway uses to pull the internal API
GATEWAY_INTERNAL_BASE_URLβšͺChannel health aggregation; distinguish gateway 8088 vs the internal mgmt port
AGX_PROVIDER_SECRET_KEYβœ…AES-256-GCM key for Provider API Keys (32-byte base64)
SSO_PROVIDER_SECRET_KEYβœ…AES-256-GCM key for SSO client_secret
NEXT_PUBLIC_SSO_PROVIDERSβšͺSame as portal; controls the admin SSO entry

4. apps/gateway (:8088)

4.1 Basics

VariableDefaultDescription
GATEWAY_HTTP_ADDR:8088Listen address
GATEWAY_CONFIG_PATHβ€”YAML config path (model routing)
AUTH_JWT_PUBLIC_KEYβ€”JWT verification (required)
DATABASE_URLβ€”Audit / metering PG dual-write

4.2 Upstream key resolution (in order)

VariableDescription
<PROVIDER>_API_KEYProvider name uppercased, - β†’ _, e.g. DEEPSEEK_API_KEY
LLM_API_KEYGeneric fallback
Unconfiguredmock fallback (policy / audit / metering still run)

Priority: PG api_key_cipher > <PROVIDER>_API_KEY > LLM_API_KEY > mock

4.3 Remote config (recommended for Vercel split)

VariableMatching admin internal route
GATEWAY_INTERNAL_TOKENBearer (must match admin)
GATEWAY_REMOTE_PROVIDERS_URL/api/internal/providers
GATEWAY_REMOTE_QUOTA_CONFIG_URL/api/internal/quotas
GATEWAY_REMOTE_POLICY_SNAPSHOT_URL/api/internal/policy-snapshot
GATEWAY_REMOTE_CHANNELS_URL/api/internal/channels

4.4 Local file fallback

VariablePurpose
GATEWAY_ADMIN_PROVIDERS_FILEproviders.json
GATEWAY_QUOTA_CONFIG_FILEquotas.json
GATEWAY_QUOTA_USAGE_FILELocal quota-usage persistence
GATEWAY_POLICY_SNAPSHOT_FILEPublished policy snapshot
GATEWAY_POLICY_OVERRIDE_FILELocal policy override (debugging)
GATEWAY_USAGE_LOGMetering jsonl path when PG is unavailable

4.5 Audit

VariableDefaultDescription
GATEWAY_AUDIT_BACKFILL_DAYS7Startup backfill window for .pg-pending

4.6 Stream hardening

VariableDescription
GATEWAY_STREAM_IDLE_TIMEOUTSSE idle cutoff
GATEWAY_STREAM_SCANNER_MAX_BUFFER_MBMax buffer per chunk

4.7 Channel relay

VariableDescription
GATEWAY_CHANNEL_REGISTRYon to enable

5. Key generation and rotation

bash
1# RSA-2048(JWTοΌ‰
2openssl genrsa -out auth_private.pem 2048
3openssl rsa -in auth_private.pem -pubout -out auth_public.pem
4
5# AES-256-GCM ε―†ι’₯(32 ε­—θŠ‚ base64οΌ‰
6openssl rand -base64 32

Rotating AGX_PROVIDER_SECRET_KEY / SSO_PROVIDER_SECRET_KEY requires re-encrypting all existing cipher rows; use an ops batch script.


6. Deployment checklist cross-references


7. Common pitfalls

SymptomCause
Changing SSO env has no effectNext.js does not hot-reload SSO env; a full restart of portal / admin is required
Gateway cannot see admin ProvidersGATEWAY_INTERNAL_TOKEN mismatch between the two sides
Token chip always shows 0gateway and portal DATABASE_URL point at different databases
Policy published but not blockingWrong GATEWAY_POLICY_SNAPSHOT_FILE path (pointing at the wrong .runtime root)
chat history operation failedPostgres not running, or DATABASE_URL is wrong

See development/troubleshooting.md.

Made-with: Damon Li