Docs
Guides

Idempotency

Protect retried logical operations from duplicate usage charging.

Idempotency-Key

Reuse an Idempotency-Key only when retrying the same logical operation. It protects duplicate usage charging; it does not identify a gateway request, cache a response, or guarantee that an upstream Provider call is skipped.

cURL
1curl https://qufas-ai.vercel.app/v1/images/generations \2  -H "Authorization: Bearer $QUFAS_API_KEY" \3  -H "Idempotency-Key: image-order-4821-v1" \4  -H "Content-Type: application/json" \5  -d '{"model":"<enabled-image-model-id>","prompt":"A blue robot","response_format":"url"}'

Correct usage

  • Generate one stable value for one logical operation.
  • Reuse it after a timeout or uncertain transport failure for that same operation.
  • Do not reuse a value across unrelated prompts, users, or operations.
  • Keep the request payload consistent when reusing the key.

Request ID is different

x-qufas-request-id is the canonical trace identifier generated for each gateway request. A retry may have a new request ID while retaining the same idempotency key.

Was this page helpful?