Abort a waitForJob wait with AbortSignal: the Sume job keeps running
Passing signal to waitForJob stops your wait and aborts the in-flight request. It does not cancel the job, which keeps running and billing. Keep the job id.

Aborting a waitForJob call with an AbortSignal ends your wait, not the job. The in-flight status request is aborted, the call rejects with the signal's reason, and the Sume job keeps running and billing. To stop the work itself, call the cancel endpoint, which succeeds only before generation has started.
What the SDK does on abort
The signal option is checked before each poll and passed to each request, and the sleep between polls is also cut short when the signal fires. The Jobs docs say the same about any client-side timeout: it does not cancel the job, and you only stopped the wait.
| Thing | After abort |
|---|---|
Your waitForJob promise | Rejects with signal.reason |
| The in-flight status request | Aborted |
| The Sume job | Keeps running and billing |
| The job id | Still valid: read /v1/jobs/:id later |
Stop waiting, keep the id
Store the job id before you start waiting. After an abort, the same id lets you resume with another waitForJob call, or read it once with GET /v1/jobs/:id.
import { createSumeClient, waitForJob } from "@sume-com/sdk";
const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
const jobId = process.argv[2]!;
const controller = new AbortController();
setTimeout(() => controller.abort(), 60_000);
try {
const job = await waitForJob(jobId, { client, signal: controller.signal });
console.log(job.status);
} catch (error) {
if (!controller.signal.aborted) throw error;
console.log("stopped waiting; job still runs:", jobId);
}If you also want the job to stop
POST /v1/jobs/:id/cancel works only before generation work starts. After that the API answers 409 job_generation_already_started with details.cancelable: false, and the job runs to completion. Calling cancel on a job that is already canceled returns the same canceled job.
Sources
Related posts
More in Developers
- Celery task for an AI video API: submit, poll, retry on Wan 3.0
Two Celery tasks for Sume's /v1/videos: one submits a Wan 3.0 job with an Idempotency-Key, one polls with self.retry(countdown) and stops on a terminal status.
- Check a reference URL before an image edit: HTTPS, HEAD, content type
Sume rejects non-public or non-HTTPS reference URLs with a 400. A 15-line Python preflight checks scheme, HEAD status and image content type before you spend.
- Check a Shorts timeline body offline: a Python mirror of the rules
Catch Timeline 1.0 refusals you can see in the body (start at 0, 0.5 s coverage, transitions, even sizes) in 28 lines of Python before the plan call.
- Check an image request against the Sume catalog before you send it
Fetch GET /v1/images/models once, then reject a bad ratio, quality or reference count in Python before it reaches POST /v1/images and returns a 400.
Written by Sume