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.

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.
| Target | Command underneath | Safe to rerun |
|---|---|---|
submit | curl POST with Idempotency-Key: $(KEY) | Yes, same key replays |
watch | sume jobs watch <job_id> | Yes, read only |
download | sume jobs download <job_id> --output-dir ./out | Yes |
cancel | sume jobs cancel <job_id> --confirm-submit | Only 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
- Map your Sora error handling onto Sume's error envelope
Sume errors share one envelope: code, message, request_id. Rebuild your handler around code, rate-limit headers and retry-after, not message text.
- Mastodon media focal point: x and y from -1 to 1, 16:9 crops
Mastodon preview images are never cropped by the server, so apps crop them using a focal point from -1.0 to 1.0. How to compute it from a pixel in a Sume image.
- MCP 2026-07-28 deprecations: SSE, sampling, roots, logging checklist
MCP 2026-07-28 deprecates Roots, Sampling and Logging and reclassifies HTTP+SSE as Deprecated, with 12 months of notice. A checklist for media servers.
- MCP deprecations, removal from July 2027: audit Sume client
An MCP 2026-07-28 release candidate deprecates Roots, Sampling, Logging, Dynamic Client Registration and HTTP+SSE, removal no earlier than July 28, 2027.
Written by Sume