Skip to content

OpenRouter Gateway Configuration

API tokens, fallback models array, request timeouts, and circuit breakers

Gateway Authentication & Resilience

Bearer token used for unified LLM chat completions.
Identifies your application on OpenRouter analytics rankings.
Extended for reasoning models (DeepSeek-R1, o1).
Automatic failover sequence if primary provider experiences downtime.

Circuit Breaking Safeguards

Prevents endless batch retry storms when upstream limits are encountered:

  • HTTP 402 (Insufficient Balance): Aborts the batch queue immediately, marks remaining items failed, and logs an alert.
  • HTTP 429 (Rate Limit): Backs off exponentially before routing to the next model in the fallback array.
  • Markdown Strip Filter: Cleanses ```html wrappers automatically before saving raw HTML to MySQL.