Idempotency
idempotency-key is accepted on POST /v1/tasks, POST /v1/jobs, POST /v1/uploads and POST /v1/jobs/{id}/cancel; its value is the client's, up to a length Not decided yet, scoped to the key. The SDK generates one per task and job call.
| Rule | Behavior |
|---|---|
| First request | Served; the key, the body's hash and the response are kept for the window Not decided yet |
| Same key, same body, within the window | The stored response is returned, same status and body, with the original x-hips-request-id. Nothing runs, nothing is billed again |
| Same key, different body | 400 idempotency_key_reused |
| Same key while the first is still being answered | 400 idempotency_in_progress |
| A replay of a job | Returns the job object; the job's result is read from the job, not from a stored copy |
| Not on chat completions | POST /v1/chat/completions and /v1/responses take no idempotency-key: a replay would need the gateway to store a completion body, which it never does. A retried chat completion is a new request, a new quote and a new charge |
- Rule
- First request
- Behavior
- Served; the key, the body's hash and the response are kept for the window Not decided yet
- Rule
- Same key, same body, within the window
- Behavior
- The stored response is returned, same status and body, with the original
x-hips-request-id. Nothing runs, nothing is billed again
- Rule
- Same key, different body
- Behavior
- 400
idempotency_key_reused
- Rule
- Same key while the first is still being answered
- Behavior
- 400
idempotency_in_progress
- Rule
- A replay of a job
- Behavior
- Returns the job object; the job's result is read from the job, not from a stored copy
- Rule
- Not on chat completions
- Behavior
POST /v1/chat/completionsand/v1/responsestake noidempotency-key: a replay would need the gateway to store a completion body, which it never does. A retried chat completion is a new request, a new quote and a new charge
- Generate the key before the first attempt and reuse it on every retry of the same body.
- Treat a 400
idempotency_in_progressas a signal to wait and retry with the same key, not as a failure. - A different body with the same key is a 400
idempotency_key_reused: a bug in the caller, never retried. - The replay carries the original
x-hips-request-id, so the Console shows one request and one charge.
Related sheets
- Sheet
- 12 of 13
- Detail
- D
- Updated
- 2026-10-21
- Status
- Preview