Skip to content

Rate limits and errors

Read the status, decide whether to retry and collect the information support needs.

Plan for shared model limits

A personal account can make 60 requests per minute with up to 8 in flight. A customer organization shares 120 requests per minute and up to 32 in flight across its members and keys. Queue requests in your application when you approach either limit.

Read x-ratelimit-limit-requests, x-ratelimit-remaining-requests and x-ratelimit-reset-requests on admitted model requests. For HTTP 429, wait at least the number of seconds in Retry-After before retrying.

Correct a refused model request

400 or 413 means the request is invalid or too large. Read error.param and error.message. For a large conversation, send fewer messages or shorten them. For 401, check the key, bearer header and API host. For a personal model request that returns 402, check personal credit. For 403, check the account’s permission.

For 404 on a model, call the model list with the same key and choose an ID in that response. For 502, 503 or 504, wait briefly and retry with increasing delays. A response can fail after streaming starts. Handle an error event before treating a partial draft as complete.

Recover a run request

Terrarium errors have an error.code and error.message and can include error.details. For 402, check the organization’s balance with the account endpoint. For 422, follow the field location in details and validate the amended scenario. The validation endpoint itself can return HTTP 200 with valid set to false. Send an Idempotency-Key when creating or forking a run. If the connection drops, repeat the same request with the same key. A replay includes Idempotent-Replayed: true. Changing the request while reusing its key returns 409. If a run control returns 409, read the run’s current status before trying again.

For repeated failures, send support the time, endpoint, HTTP status and the model response’s x-request-id or the Terrarium run ID.