Makefile targets to submit, watch and download a Sume video job

Three make targets: curl submits to video-router with an Idempotency-Key, sume jobs watch waits, sume jobs download saves it. Rerunning submit never pays twice.

6 min readSume
All posts

Use curl to submit to POST /v1/video-router/generate with a stable Idempotency-Key, store data.request_id in a file, then run sume jobs watch and sume jobs download --output-dir against that id. The CLI has no video submit command, so the API call is the only way in; the sume jobs commands recover and fetch.

Targets and what they do

The same KEY always reuses the same job, because Sume treats the key as the idempotency handle. If make submit is interrupted and run again, the second call replays instead of creating a second paid job.

Makefile targets (read 2026-10-04)
TargetCommand underneathSafe to rerun
submitcurl POST with Idempotency-Key: $(KEY)Yes, same key replays
watchsume jobs watch <job_id>Yes, read only
downloadsume jobs download <job_id> --output-dir ./outYes
cancelsume jobs cancel <job_id> --confirm-submitOnly before generation starts

Makefile

Recipe lines must start with a tab. The --fail-with-body flag, added in curl 7.76.0, returns exit code 22 on HTTP 400 or above and still prints the response body, so Sume's error envelope lands in your log.

SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
KEY  ?=
OUT  ?= out
JOB  = .sume-job-$(KEY).id

submit:
	test -n "$(KEY)" || { echo "usage: make submit KEY=<stable-id>" >&2; exit 2; }
	test -n "$$SUME_API_KEY" || { echo "SUME_API_KEY is empty" >&2; exit 2; }
	curl -sS --fail-with-body -X POST https://api.sume.com/v1/video-router/generate \
	  -H "x-api-key: $$SUME_API_KEY" -H "Content-Type: application/json" \
	  -H "Idempotency-Key: $(KEY)" \
	  -d '{"model":"seedance-2.5","prompt":"A product clip on a desk, natural light","resolution":"720p","duration":8,"aspect_ratio":"9:16","mode":"async"}' \
	  | python3 -c 'import json,sys; print(json.load(sys.stdin)["data"]["request_id"])' > $(JOB)
	@echo "job: $$(cat $(JOB))"

watch:
	sume jobs watch $$(cat $(JOB))

download:
	sume jobs download $$(cat $(JOB)) --output-dir $(OUT)

Model limits

seedance-2.5 accepts 4 to 30 seconds at 480p, 720p and 1080p per the Video Router docs, so duration: 8 is valid. Check any other model with GET /v1/video-router/models first.

After a timeout

If sume jobs watch times out, the job is still running. Run make watch again; never change the KEY to retry. See what to do after a watch timeout.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume