Retry an image edit after a timeout: same key, same payload
After a client timeout on an image edit, resend the same payload with the same Idempotency-Key. If you change the prompt, change the key.

When an image edit times out on your side, send the identical request with the identical Idempotency-Key; when you change anything that matters (prompt, reference, quality), use a new key. Sume's docs state the rule directly: use the same key again only for the same operation and payload. The retry then returns the original job instead of billing a second one.
Why a timeout is not a failure
A client timeout tells you your process stopped waiting, not that Sume stopped working. The Jobs and results docs say not to submit the original paid request again only because a local process timed out. Poll GET /v1/jobs/{id}/status if you have the id. If you do not, retry the submit with the same key.
What to do with the 202 case
A 202 is not an error. It means Sume accepted the work and it did not finish inside the wait. The docs say the image route blocks for up to 30 seconds, then returns 202 with the job envelope. In that case you must not submit again; poll status_url until terminal is true, and obey next_poll_after_seconds when it is present. Then fetch the result from result_url.
A client timeout is a different case. You may not have seen the 202 at all, because your client gave up first. That is when the same-key retry saves you.
Mistakes to avoid
- Generating a random key on every attempt. It defeats the purpose and can double bill.
- Reusing one key for a whole batch. Each edit needs its own key.
- Retrying a
402 insufficient_creditsin a loop. Add funds first. - Retrying a
400without changing the request. The request is wrong, not unlucky.
Which key for which case
| Case | Key | Why |
|---|---|---|
| Timeout, no response seen | Same key, same body | Returns the original job; no second bill |
| Got 202 with a job id | Poll status_url; no new submit | The job exists already |
| Result was wrong, you change the prompt | New key | It is a new operation |
| You switch quality low to high | New key | The payload changed |
| 429 or 503 before acceptance | Same key after backoff | The docs say retry later with the same key on queue errors |
A key scheme
Make keys readable and deterministic, so a crashed script resumes safely. Build them from your own ids: edit-{asset_id}-{prompt_version}-{quality}. The same asset with the same prompt version and quality always yields the same key. Bump prompt_version when you change the prompt. That makes the rule automatic and keeps an audit trail.
One caution: a key does not make a completed bad image free: a completed edit is billed in full, as the Image API docs say. A failed or cancelled one is not.
A last point on keys. Make them easy to trace: build each from the business object and the operation, for example the asset id plus the edit name plus a version. When something looks wrong in your logs you can then tell at a glance which operation a request belonged to, and whether a retry used the same key as its first attempt. Never put secrets or personal data in a key. Keep the scope of this advice in view. It rests on the Sume docs and the vendor pages named in the sources, read on 2026-10-05, and on nothing measured by Sume. Where a behavior depends on your own images, such as how a model redraws a certain typeface, run a small pilot at the low quality tier and judge the result yourself before you plan a batch. Write down the prompt, the model id and the quality tier you used, so the run can be repeated. When the catalog or the docs change, re-read them; the live catalog is the contract, and a post is only a snapshot of it.
Sources
Related posts
More in Developers
- image-generations_create is now generate_image: fix old MCP prompts
The Sume MCP tool image-generations_create was retired for generate_image. Update agent prompts and allow-lists, and check with tools_list. Dated facts.
- MCP: read image-models_get, then dry-run generate_image first
An agent checklist for hosted Sume MCP: read the model with image-models_get, dry-run generate_image with a spend cap, then submit with a new idempotency key.
- A 4K image request returns 202: poll the job and fetch the result
POST /v1/images waits 30 seconds. Slow 4K or high-quality calls return 202 with a job envelope. Python that handles both and polls to completion.
- Imagen 4 Fast has no 4:5: generate 3:4 and crop to 1080x1350 in Pillow
Imagen 4 Fast and Grok skip 4:5 on Sume. Request 3:4, then crop to 1080x1350 with ImageOps.fit and a top-biased centering so heads and product tops survive.
Written by Sume