Failures and scaling
What happens when a provider, the database, the ledger or a copy of the gateway fails, and how it grows.
| What fails | What happens |
|---|---|
| A model or provider | the route’s fallbacks take over. After 5 failures in 30 seconds the gateway stops sending to that model for 30 seconds, then tries again with one call. GET /health and Telemetry show it. |
| Postgres | calls whose key and route are already cached keep going for up to 5 minutes, with stricter limits (half the per-minute limits; caps checked against the last known totals). Records wait and are written when it is back. Browser tokens and routes with per-person limits stop with 503 rather than run without their limit. |
| The credits ledger Cloud | holds wait in a queue; calls continue only up to your last known balance minus what is already held, and never past a spending limit |
| The usage queue Cloud | records go to a dead-letter queue and are replayed; each record carries its call id, so nothing is lost or counted twice |
| A copy of the gateway, mid-answer | your app sees the stream end early; only the tokens written are charged, and a sweep releases the rest of the hold within 15 minutes |
Growing
The gateway keeps no state between calls, so more traffic means more copies of it: in Sypnia Cloud, more Lambda instances. Call records are split by day, so dropping old days costs nothing, and usage totals are summed once a day.