A "use step" function that submits a Sume job once
Put the Sume submit call inside one "use step" function and derive the Idempotency-Key from a stable run key, so a retried step returns the original job.

Workflow Development Kit v4.8.11, released Oct 1, 2026, fixed directive discovery for the "use step" and "use workflow" statements, per the Vercel release notes. For Sume, wrap the paid submit in one "use step" function and pass an Idempotency-Key built from a stable run key, so a retry returns the original job instead of billing a second one.
Why the key matters
Sume's docs say to send Idempotency-Key on submit requests when retrying after a client-side timeout or network failure, and that a replay returns the original job. Reuse the same key only for the same operation and payload. A durable step that can be retried is exactly the case that rule exists for.
The step
The key must be the same on every attempt of the step, so it cannot come from Date.now() or a random value created inside the step. Pass it in as an argument that comes from the workflow's own input or run id:
async function submitSumeJob(runKey: string, prompt: string) {
"use step";
const apiKey = process.env.SUME_API_KEY;
if (!apiKey) throw new Error("SUME_API_KEY is not set");
const res = await fetch("https://api.sume.com/v1/video-router/generate", {
method: "POST",
headers: {
"x-api-key": apiKey,
"Content-Type": "application/json",
"Idempotency-Key": runKey,
},
body: JSON.stringify({
model: "seedance-2.5",
prompt,
duration: 8,
resolution: "720p",
aspect_ratio: "9:16",
mode: "async",
}),
});
if (!res.ok) throw new Error(`Sume submit failed: ${res.status}`);
return res.json();
}Separate submit from wait
Keep the submit in its own step and the waiting in another. A step that both submits and polls can be retried after the paid job is already running. With the key fixed, even that retry is safe, but a separate step is easier to reason about.
- Step 1: submit with a stable
Idempotency-Key, return the job id - Step 2: poll
GET /v1/jobs/{id}/statuswith backoff until terminal - Step 3: read
GET /v1/jobs/{id}/resultand pass the artifact URL on - Never resubmit a paid request because a poll timed out
Sources
Related posts
More in Developers
- Veo is US-region only: what EU teams call on Sume
A Sept 2026 listing says Veo runs only in us-central1, with no EU region documented. Sume has one video endpoint and its docs state no region.
- Vercel renamed Edge Requests: match Sume errors by code, not text
Vercel Edge Requests are now CDN Requests, and billing reads should use SkuId. Same rule for Sume errors: branch on error.code and request_id, never message.
- Sume webhook signature header: why the sume-v1= prefix is checked
verifyWebhook only compares entries that start with sume-v1= and drops others, so a future scheme in the same header cannot break a receiver. A test proves it.
- v1/videos/models `created` is a catalog date, not a release date
Every model on Sume's /v1/videos/models shows created 1767225600, which is 2026-01-01. It is not when Gemini Omni 1.1 Flash or MiniMax H3 launched.
Written by Sume