waitForJob onStatus also fires on the terminal poll: Sume SDK
In @sume-com/sdk, onStatus runs on every status read, including the last one. Use it for progress and take the result from the job waitForJob returns.

onStatus in waitForJob is called on every status read, and that includes the terminal one. So it can tell you a job is failed or canceled as well as completed. Use it to draw progress, and take the outcome from the job that waitForJob returns, because the helper makes one more read after the last poll.
This matters most for teams moving off a video API such as OpenAI's Videos API, which OpenAI's deprecations page lists for removal on 2026-09-24 with no replacement named (read 2026-10-06). Progress UI code written against one vendor's status words often marks a job as done on the first terminal-looking callback.
What the callback receives
The callback gets two arguments: the sume_status value and the whole status payload. In the SDK source the payload type is SumeJobStatusSnapshot, and its comment names the useful fields: next_action, next_poll_after_seconds, and queue.
| Argument | Type | Use |
|---|---|---|
status | queued, processing, completed, failed, canceled | Drive a progress label |
snapshot.next_poll_after_seconds | number or null | Show when the next check runs |
snapshot.queue.state | string enum | Show waiting or processing |
snapshot.next_action | poll_status, fetch_result, inspect_events | Tell the user what happens next |
A minimal progress hook
The returned value is the job record from GET /v1/jobs/:id. It resolves for any terminal status, so check job.status there, not inside the callback.
import { createSumeClient, waitForJob } from "@sume-com/sdk";
const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
const jobId = process.argv[2]!;
const job = await waitForJob(jobId, {
client,
onStatus: (status, snap) => {
console.log(status, snap.queue.state, snap.next_poll_after_seconds);
},
});
console.log("final:", job.status);What to avoid
- Do not render a success state inside
onStatus:failedandcanceledarrive through the same callback. - Do not treat a callback as a fresh poll you control. The SDK sets the pace: a 2 second floor, raised by the server's
next_poll_after_seconds. - Do not read the artifact list from the snapshot. Read it from the returned job, or from
GET /v1/jobs/:id/resultonceresult_readyis true.
Sources
Related posts
More in Developers
- waitForJob pollInterval is a floor: Sume's hint can only lengthen it
Lowering pollInterval in waitForJob does not poll faster than the server asks. The SDK takes the larger of your interval and next_poll_after_seconds.
- Wan 3.0 lists 20 references; Sume caps 10 images, 5 videos, 5 audio
Wan 3.0's own page says up to 20 reference assets. Sume splits that into 10 images, 5 videos and 5 audio clips. Validate a request offline in Python first.
- What a 30-second Wan 3.0 job reserves on Sume: list times 1.25
Sume reserves the provider list price times 1.25 at submit. Work out the hold for a 30-second Wan 3.0 clip and other models in Python.
- Wan 3.0 file_url, web_url, enable_thinking: not in Sume v1
Sume's wan-3.0 id does not expose file_url, web_url or enable_thinking, and provider.options must stay empty. Use references and prompt fields instead.
Written by Sume