Skip to main content
Use a current public model ID from Models or GET /models. Example IDs and options must match the selected model’s advertised capabilities and limits.
Networks fail. Idempotency keys let you retry a completion request safely, guaranteed to never be billed twice for the same work.

How it works

Send an Idempotency-Key header (any unique string you generate, such as a UUID) on a non-streaming completion request. If a request with the same key and the same body already succeeded in the last 24 hours, the original response is replayed with an Idempotency-Replayed: true header and nothing new is billed.

Example

Rules and lifetime

  • Replays require the same key and the same request body. A changed body with a reused key is treated as a new request.
  • Keys are scoped to the API key that made the request.
  • Stored responses expire after 24 hours.
  • Streaming requests do not use this retry cache.
  • Only successful responses are stored. A failed request can always be retried.