Configuration

All configuration is environment-driven and validated once at startup by Config.from_env; a missing required variable fails fast with its name.

Required

Variable

Meaning

KEYS_TABLE

DynamoDB table of API-key digests

USAGE_TABLE

DynamoDB table for the usage ledger and rollups

CLOUDMAP_NAMESPACE

Cloud Map namespace of GPU gateways (only when no local model)

CLOUDMAP_SERVICE

Cloud Map service GPU gateways register into (only when no local model)

Local model execution

Variable

Meaning

RELATIVEDB_MODEL

checkpoint URI; when set, /v1/forward and /health execute in-process on the GPU (requires pip install 'relational-transformers-gateway[inference]') and Cloud Map becomes optional

Optional

Variable

Default

Meaning

PORT

8080

listen port for rtg-serve

UPSTREAM_TIMEOUT_SECONDS

25

per-attempt timeout for workers and the LLM provider

MAX_BODY_BYTES

10485760

request-body cap (413 above it)

DISCOVERY_CACHE_SECONDS

5

Cloud Map result cache

AUTH_CACHE_SECONDS

30

API-key lookup cache; 0 disables

WORKER_ATTEMPTS

3

workers tried per request on connection failure

RATE_LIMIT_RPS

0

per-customer token-bucket rate; 0 disables

RATE_LIMIT_BURST

2 × rps

token-bucket burst capacity

OPENAI_API_KEY

LLM provider credential; unset returns 503 on LLM paths

OPENAI_BASE_URL

https://api.openai.com

OpenAI-compatible provider base

OPENAI_ALLOWED_MODELS

gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna

model allowlist

USAGE_RETENTION_DAYS

90

request-ledger TTL

Semantics worth knowing

  • Auth caching applies to both hits and misses, so a revoked key keeps working for at most AUTH_CACHE_SECONDS and an invalid key cannot hammer DynamoDB.

  • Retry policy: only connection-level failures move to the next worker. An HTTP error from a worker is authoritative and returned as-is, because re-running a scoring request elsewhere could duplicate work.

  • Rate limiting is per-customer and in-memory — one gateway machine enforces it exactly; horizontal replicas each carry their own bucket.

  • /v1/models responses are filtered to OPENAI_ALLOWED_MODELS so the provider’s full catalog is never exposed to customers.