On this page

Rate limits and errors

Each organization has rate limits. They protect the shared replicas and keep latency steady for all customers.

Limits of each plan#

PlanRequests each minuteTokens each minute
Free60200,000
Pro6002,000,000
Enterprise6,00020,000,000

The limits are for the organization, for all its keys together. The tokens are input and output tokens. The dashboard page Limits shows the limits of your plan.

Rate limit headers#

Each response tells you how much of the limit remains.

HeaderMeaning
X-RateLimit-Limit-RequestsThe requests each minute of your plan.
X-RateLimit-Remaining-RequestsThe requests that remain in this minute.
X-RateLimit-Limit-TokensThe tokens each minute of your plan.
X-RateLimit-Remaining-TokensThe tokens that remain in this minute.
X-RateLimit-ResetWhen the limit resets.

A response with status 429 also has Retry-After, in seconds.

Size limits#

LimitValue
Request body, JSON endpoints10 MiB
Request body, /v1/predict50 MiB
Request headers16 KiB
Messages in one chat request2,048
Inputs in one embeddings request2,048

Above a size limit, the API returns status 413.

Spend limits and budgets#

The monthly spend limit stops all requests of the organization when it is reached. A budget stops the requests of one key or one deployment. See Cost control.

Errors#

Each error has a JSON body with error.code, error.message and error.request_id.

StatusCodeWhat to do
400invalid_requestCorrect the request. The message names the problem.
401invalid_api_keyUse a key that is valid and not revoked.
402spend_limit_reached, budget_reachedRaise the limit or the budget, or wait for the next month.
403permission_denied, org_suspendedUse a key with the necessary scope and a model in the key's model list.
404not_foundCheck the model ID or the deployment ID.
413request_too_largeMake the request smaller.
429rate_limitedWait for the time in Retry-After, then send again.
503warming, unavailable, auth_unavailableA replica starts, or a service is busy. Send again after a few seconds.
504upstream_timeoutThe model did not answer in time. Send again.

Send again safely#

  1. Send again only after 429, 503 and 504 errors, and after network errors.
  2. Wait for the time in Retry-After. If there is no header, wait 1 second, then 2 seconds, then 4 seconds.
  3. Stop after five attempts. Then examine the error.
  4. Keep X-Request-Id of each failed request. Support needs it.