Cancel an image job: it only works before generation starts
POST /v1/jobs/{id}/cancel succeeds only while a Sume job has not started generating. Here is the 409 you get otherwise, and what is billed after a cancel.

You can cancel a Sume image job only before generation work starts. POST /v1/jobs/{id}/cancel on a queued job cancels it; once generation has begun the API returns 409 job_generation_already_started with details.cancelable: false, and the job runs to completion.
That matters when you fan out many variants: a batch you submitted by mistake is cheap to stop while its jobs wait in queued, and expensive after they start.
What does the cancel call return?
Cancelling a job that is already canceled is idempotent and returns the same canceled job.
| Job state | Cancel result |
|---|---|
queued | Cancelled; job becomes canceled |
processing, generation started | 409 job_generation_already_started, details.cancelable: false |
canceled | Same canceled job, idempotent |
completed or failed | Not cancelable |
How do I cancel in Python?
Handle the 409 as a normal answer, not an error to retry.
import os
import requests
BASE = "https://api.sume.com/v1/jobs"
HEADERS = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}
def cancel(job_id: str) -> str:
r = requests.post(f"{BASE}/{job_id}/cancel", headers=HEADERS, timeout=30)
if r.status_code == 409:
return "too late: generation already started"
r.raise_for_status()
return r.json().get("status", "canceled")
for job_id in ["job_123", "job_124"]:
print(job_id, cancel(job_id))Is a cancelled image billed?
Sume's Image API docs say image generation billing is all-or-nothing: completed generations are billed in full, failed or cancelled generations are not. A job that already started cannot be cancelled, so it completes and bills.
Read GET /v1/jobs/{id}/status before and after to confirm the state; the Jobs and results docs list every status.
Sources
Related posts
More in Developers
- Cancel a completed job: 409 job_not_cancelable vs already started
Sume returns 409 job_not_cancelable when you cancel a finished job, and job_generation_already_started mid-run. How to tell them apart and handle each.
- Cancel a queued Seedance 2.5 job: it works only before it starts
POST /v1/jobs/{id}/cancel stops a queued seedance-2.5 job; once generation has started you get 409 job_generation_already_started and it still bills.
- Cancel queued Sume jobs on SIGTERM during a deploy
On shutdown, cancel jobs you no longer need before they start and leave started ones alone. A 21-line Node handler using POST /v1/jobs/{id}/cancel.
- cancel_url is null on a processing job: when Sume allows cancel
Why a Sume job in processing can show cancelable false and cancel_url null: cancel depends on whether generation work started, not the status label.
Written by Sume