Skip to main content
The gateway reads its configuration from environment variables only. There is no config file. The Helm chart sets the variables listed on Helm chart; every other variable below keeps its default unless you add it to the pod yourself. Time spans are a plain count of seconds on a _SECONDS or _S variable: 300, never 5m. A value outside ±10 years is refused at startup.

Required

LW_GATEWAY_INTERNAL_SECRET and LW_GATEWAY_JWT_SECRET have no default: the gateway fails configuration validation and does not start when either is empty. LW_GATEWAY_BASE_URL falls back to its default instead.

Server

Provider endpoint security

These apply to the base URLs customers configure on their own provider credentials. Cloud metadata addresses, 0.0.0.0, :: and link-local ranges are refused in every configuration.

Auth cache

The gateway caches each resolved virtual key in process. When a cached entry passes its JWT expiry and the refresh fails for a transport reason (network error, timeout, 5xx, unparseable response), the entry keeps serving: its soft expiry is extended by SOFT_BUMP_SECONDS per failed refresh, up to the JWT expiry plus HARD_GRACE_SECONDS. A 401, 403 or 404 from the control plane evicts the entry at once. The retired names LW_GATEWAY_AUTH_CACHE_SOFT_BUMP, LW_GATEWAY_AUTH_CACHE_HARD_GRACE and LW_GATEWAY_AUTH_CACHE_CONFIG_TTL are refused: the gateway stops at startup and names the _SECONDS variable to set instead.

Circuit breaker

Each provider credential has its own breaker. Once THRESHOLD failures land inside WINDOW_S, the breaker opens and the credential is skipped for COOLDOWN_S, after which one probe request is let through. The state is exported as gateway_circuit_state.

Spend emission

Every request writes a spend record to an on-disk spool. A background drainer ships the spool to the control plane, which debits budgets from it.

JWT secret rotation

The procedure is on Helm chart. There is no previous-key variable for LW_GATEWAY_INTERNAL_SECRET.

Logging

Telemetry

These variables configure the gateway’s own spans and metrics. Customer traces go through the trace bridge below and never read OTEL_*. The exporter speaks OTLP over HTTP/protobuf only. Three deprecated names still work and log a rename warning at boot: OTEL_OTLP_ENDPOINT (use OTEL_EXPORTER_OTLP_ENDPOINT), OTEL_OTLP_HEADERS (use OTEL_EXPORTER_OTLP_HEADERS) and OTEL_SAMPLE_RATIO (use OTEL_TRACES_SAMPLER=parentbased_traceidratio with OTEL_TRACES_SAMPLER_ARG). A deprecated name and its replacement set to different values stop startup. The gateway does not check the scheme on these endpoints. An http:// collector sends OTEL_EXPORTER_OTLP_HEADERS in cleartext, so use https:// whenever the collector is not on the same host. Every gateway span carries the langwatch.project_id of the virtual key, so an export pointed at a LangWatch ingest files the span under the right project. See Observability.

Customer trace bridge

LANGY_MIRROR_TRACE_KEY is sent as a bearer token on every mirror export, so point LANGY_MIRROR_TRACE_ENDPOINT at an https:// URL.

Debug

Never set these on a production pod. Each one puts request content somewhere a production deployment should not have it.

Legacy aliases

Deployments that predate the canonical names can keep these. The canonical name wins when both are set.
Last modified on September 6, 2026