Does the Sume SDK retry a failed video submit? Only with a key
createSumeClient retries GET and HEAD by default and retries a POST only when an Idempotency-Key header is set. See what is retried, what is not, and why.

Will the Sume SDK retry a failed generation submit?
Only if you sent an Idempotency-Key. The client built by createSumeClient retries GET and HEAD requests on its own, and it retries any other method only when the request carries that header. Without a key, a failed POST is thrown to you after one attempt, because replaying it could start and charge a second job.
That default is the right one for video. A 30 second generation is paid work, and an ambiguous failure, such as a dropped connection after the server accepted the request, is exactly the case where a blind retry duplicates the spend. With a key, a replay of the same body returns the original job.
What gets retried and how
The retry count comes from maxRetries, which defaults to 2, and the wait between attempts uses backoff with random jitter so many clients do not retry in lockstep. When the server sends retry-after, the SDK honours it, capped at 60 seconds.
| Request or status | Retried? | Reason |
|---|---|---|
| GET or HEAD | Yes | Replay-safe |
| POST or PUT with Idempotency-Key | Yes | A replay returns the same job |
| POST without Idempotency-Key | No | A replay could create a second paid job |
| Status 408, 429 or 5xx, or no response | Yes, when the request qualifies | Transient by nature |
| Status 409 | No | A conflict repeats, it does not clear |
Submit with a key
Derive the key from something stable in your system, such as an order id, so that your own retry after a crash produces the same key. The generated operations resolve to { data, error, response } and do not throw, so check error yourself.
import { createSumeClient, generateVideoV1 } from "@sume-com/sdk";
const client = createSumeClient({
apiKey: process.env.SUME_API_KEY,
maxRetries: 2,
});
export async function submit(orderId, prompt) {
const { data, error, response } = await generateVideoV1({
client,
headers: { "idempotency-key": `order-${orderId}` },
body: { prompt, mode: "async" },
});
if (error) {
throw new Error(`submit failed (${response?.status}): ${JSON.stringify(error)}`);
}
return data.data.request_id;
}
console.log(await submit("1042", "Slow push-in on a ceramic mug"));Limits of the built-in retry
Two retries with short backoff cover a blip, not an outage. For a 429 queue_full or a 503 provider_capacity_exceeded, wait longer in your own code and submit again with the same key. A different body with the same key is a 409 idempotency_conflict, and the SDK will not retry that, which is what you want.
Keep the key alive as long as you might retry. Store it with the order, and if you change the request on purpose, mint a new key so the change is a new job and not a conflict.
Sources
Related posts
More in Developers
- Sume STT mode sync: transcribe a short clip in one request
Send mode sync with wait_timeout_seconds up to 30. A short clip answers 200 with the finished job. A longer one answers 2xx with the queued job to poll.
- Sume STT to an SRT file: build subtitles from sentence segments
Sume returns timed sentence segments, not an SRT. Turn them into a valid .srt file in Python for YouTube, Vimeo or a player, with the timestamp format.
- Preview Sume TTS sentence ids, lengths and job cost before you submit
A short Python script that splits a script like Sume's source API, groups sentences under 20,000 characters and prices each job at $0.0475 per 1,000 characters.
- Why Sume's video models list shows 11 ids, not 12
Docs describe 12 video router ids, but GET /v1/videos/models can return 11. higgsfield-genjutsu lists only when its provider is configured. Check yours.
Written by Sume