Retries and request status

Use an idempotency key to distinguish a retry from a new request.

Choose a stable request ID#

Optionally send an Idempotency-Key header for a logical request. Any value works; keys of 8–120 letters, digits, hyphens or underscores are stored as sent, others as a digest. Generate a new value for a new request and retain it for retries of that request.

Idempotency-Key: YOUR_UNIQUE_REQUEST_ID

Retry the same input#

A retry must use the same original API key, public model ID, messages and resolved output limit. A successful recorded JSON response can be replayed for up to 24 hours after the original request; streamed responses are not replayed. The response body must still be retained.

If the input changes, the gateway returns IDEMPOTENCY_CONFLICT. If the request is recorded but no replayable response is available, it returns REQUEST_RECORDED. It does not dispatch that same recorded request again.

If the connection is interrupted#

  1. Keep the original request details

    Retain the API key, request ID, model, messages and output limit.

  2. Check Usage

    Find whether the original request is pending, complete, failed or unconfirmed.

  3. Retry deliberately

    Use the original key and identical input for a retry. Creating a new ID starts a new logical request if it is accepted.

An unconfirmed provider result releases the user reservation. Its recorded ID is not automatically sent again.

Requests running at once#

Playground and all API keys of a wallet share a limit on requests running at the same time (API_WALLET_CONCURRENCY, 4 by default). REQUEST_BUSY (429) means that limit is reached; retry when one finishes.

Search documentation

Start typing to search the documentation.