"""Budgets for durable bid work, independent of interactive chat latency.""" # The socket may spend up to 60s waiting for the next chunk; keep that bounded # tail, local validation and DB saves strictly inside the 600s execution lease. STEP_SECONDS = 510 LEASE_SECONDS = 600 RECOVERY_SECONDS = 60 def request_seconds(tokens): # Observed three-GPU throughput is 14-15 tokens/s. Reserve prefill and # slower decoding, while leaving a margin before the durable lease expires. return min(480, max(120, 30 + tokens / 12))