Skip to content

Configuration

Relay reads environment variables from process env (and commonly from .env).

Core Variables

VariableDefaultNotes
HOST127.0.0.1Bind address
PORT1234Bind port
UPSTREAM_BASE_URLhttp://127.0.0.1:8080/v1Upstream API root
UPSTREAM_CTX_SIZE(empty)Running upstream context size (for example llama.cpp --ctx-size) exposed for clients
DEFAULT_MODEL(empty)Fallback model
REQUEST_TIMEOUT_SECONDS600Upstream timeout
MAX_REQUEST_BODY_BYTES1048576Body size limit
API_KEY(empty)If set, require auth key

Startup And Logging

VariableDefaultNotes
RELAY_PROBE_ON_STARTUPtrueProbe upstream during startup
RELAY_STRICT_STARTUPfalseExit if probe fails
RELAY_OBSERVABILITY_ENABLEDtrueEnable /relay/* endpoints
RELAY_LOG_PROMPTSfalseLog prompt bodies
LOG_LEVELinfoLog level

Compatibility Tuning

Relay supports multiple model profiles and field handling policies for better behavior with local providers.

  • RELAY_MODEL_PROFILE controls defaults for known model families.
  • RELAY_FIELD_POLICY controls how unknown/hosted-only fields are handled.

Use strict modes when you want predictable failures; use permissive modes when maximizing client compatibility.