got does not retry POST by default: enable it safely with Sume
got retries GET, PUT and DELETE but not POST. To retry a Sume paid submit, add POST to retry.methods and send one Idempotency-Key reused on every attempt.

The answer
got's retry documentation says plainly that by default got does not retry on POST, and its default methods list is GET, PUT, HEAD, DELETE, OPTIONS, TRACE and QUERY. A Sume generation submit is a POST, so a dropped connection or a 502 ends in a thrown error unless you opt in.
Opting in is only safe if the server can recognise the repeat. Sume documents an Idempotency-Key request header for exactly this: reuse the same key for the same operation and payload when retrying after a timeout, and the retry returns the original job instead of billing a second one. So the rule is two settings together: retry.methods includes POST, and every attempt carries the same key.
What got retries and what it does not
The same page lists the defaults you inherit once POST is allowed. Only unsuccessful requests are retried, the default limit is 2, and the delay grows exponentially from a one second base with a little noise added.
| Option | Default | Why it matters for Sume |
|---|---|---|
| limit | 2 | Two extra attempts after the first |
| methods | GET, PUT, HEAD, DELETE, OPTIONS, TRACE, QUERY | POST is absent until you add it |
| statusCodes | 408, 413, 429, 500, 502, 503, 504, 521, 522, 524 | Includes 429 and the gateway timeouts |
| errorCodes | ETIMEDOUT, ECONNRESET, ECONNREFUSED, ENOTFOUND and others | Covers dropped connections |
The code
This is an ES module, so top-level await works. The key is built once, outside the request, so every attempt sends the same value. Build it from a business intent such as the product and revision, not from the clock.
import got from "got";
const key = "mug-hero-2026-10-03-r1";
const res = await got
.post("https://api.sume.com/v1/images", {
headers: {
authorization: `Bearer ${process.env.SUME_API_KEY}`,
"idempotency-key": key,
},
json: {
model: "sume/auto",
prompt: "A ceramic mug on a pale oak table",
mode: "async",
},
retry: { limit: 3, methods: ["POST"] },
})
.json();
console.log(res.data.request_id);Two traps to avoid
First, 413 is in got's default retry list, but a payload that is too large will be too large again; Sume answers 413 payload_too_large and a retry cannot fix it. Narrow statusCodes to the ones you expect to be transient, such as 429, 502, 503 and 504, if you want to stop wasting attempts.
Second, a different payload with a reused key is a different operation. Sume says to reuse a key only for the same operation and payload, so change the key when you change the prompt. Build the key from the intent, and the retry loop becomes safe to leave on.
When the retries run out
got throws once attempts are exhausted. Do not reach for a fresh key and submit again; the job may exist. Read the job list or your stored id first, as described in Sume's jobs docs, and only submit again if nothing was created.
Checking that the retry really deduplicated
After a retry storm you want proof that only one job exists. The reference describes GET /v1/jobs as a workspace list filterable by status and type. Compare the count against your own records: one business intent should map to one job id, and the id in the final response should equal the id from any attempt that did get through.
It also helps to log your own attempt count next to the key. If the same key shows up with different job ids, something upstream changed the payload, and that is the bug to fix before you raise the retry limit.
Finally, keep the limit small. Each retry of a paid submit that did go through is free when the key matches, but each retry of a request that failed before admission is simply latency. Two or three attempts cover the transient cases without hiding a real outage.
Sources
Related posts
More in Developers
- GPT-6.1 Sol rate limits (Tier 1: 500 RPM) vs a Sume bulk run window
OpenAI lists GPT-6.1 Sol limits from 500 RPM at Tier 1 to 15,000 RPM at Tier 5. A Sume bulk run uses a concurrency window of 1-16 and 100 items.
- GPT Image 2.5 cost per image by quality: the token math on Sume
Sume's docs: GPT Image 2.5 output is $30 per 1M tokens. At 1024x1024, xhigh is $0.09366 and max is $0.21072, before input tokens and Sume pricing.
- GPT Image 2.5 curl command: generate and download in a shell
A copy-paste curl call to Sume's POST /v1/images for GPT Image 2.5, with jq to pull the URL, download the file, and a check for the 202 job response.
- GPT Image 2.5 custom size for a 4:5 post: why 1080x1350 is rejected
Custom image_size on Sume's gpt-image-2.5 needs both edges as multiples of 16. 1080 and 1350 are not, so use aspect_ratio 4:5 or 1088x1360 and crop.
Written by Sume