plaingateway
Features

Rate limits

What happens when a host rate limits a request.

The gateway sets no request rate limit of its own, and the dashboard shows none. Hosts have their own limits. When a host answers 429, the gateway tries the model's next eligible host. It also moves on after a timeout or a 5xx. When Allow fallbacks is off on /settings/preferences, the gateway tries one host per model and returns that host's error; see Account settings. You get 429 only when the last host tried also refused. Retry-After is passed through when that host sent it. A model with one host has no other host to try. Add fallback models with models (see Model fallbacks) to spread load.

The balance is the other limit. Each request reserves its largest possible cost before it starts, from max_tokens and the prompt size. When that is more than an eighth of what the balance has left, the request holds an eighth instead and its answer limit is lowered to fit; the X-PG-Output-Cap header gives the new limit. A request gets 402 when what is left cannot pay for its prompt and a 4,096 token answer, so many large requests at once can get shorter answers, then 402, even when the balance would cover their real cost. A lower max_tokens reserves less.

The rate_limit field in GET /auth/key is deprecated and means nothing.