Seven vertical AI videos a week: a stdlib Python batch with keys

A short Python script that submits seven 9:16 video jobs to Sume with Idempotency-Keys, so a rerun never bills a second job. Standard library only.

5 min readSume
All posts

To make seven vertical AI videos a week, submit one POST /v1/videos job per day with a stable Idempotency-Key built from the week and the day, so rerunning the script returns the original jobs and bills nothing extra. The script below uses only the Python standard library, and submits the jobs without waiting for them.

The request shape and the retry rule are from the video guide and Jobs and results: the same key on a retry returns the original job instead of a second paid one.

The script

import json, os, urllib.request

API = "https://api.sume.com/v1/videos"
KEY = os.environ["SUME_API_KEY"]
WEEK = "2026-w41"
BRIEFS = [
    "Product pack on a desk, slow push-in, morning light",
    "Hands opening the pack, close-up, natural sound",
    "The product in use at a kitchen counter",
    "Before and after on a clean white background",
    "Customer-style unboxing, handheld feel",
    "Detail shot of the label, shallow depth",
    "Closing shot with the pack centered",
]

def submit(day, prompt):
    body = json.dumps({"model": "seedance-2", "prompt": prompt,
                       "aspect_ratio": "9:16", "duration": 8}).encode()
    req = urllib.request.Request(API, data=body, method="POST", headers={
        "Authorization": f"Bearer {KEY}",
        "Content-Type": "application/json",
        "Idempotency-Key": f"{WEEK}-day-{day}"})
    with urllib.request.urlopen(req) as r:
        return json.load(r)

for day, prompt in enumerate(BRIEFS, start=1):
    job = submit(day, prompt)
    print(day, job["id"], job["polling_url"])

How it behaves

Each day gets its own key, so seven different jobs are created on the first run. Run it again and the same keys return the same seven jobs. Change the prompt for a day without changing its key and you are asking for the old job, so change the key when the intent changes.

What the script relies on (read 2026-10-07)
ItemFrom the docs
SubmitPOST /v1/videos returns 202 with id, polling_url, status and model
Modelseedance-2 takes 4 to 15 seconds and lists 9:16
RetryThe same Idempotency-Key returns the original job and bills no second job
ResultPoll the polling_url until completed, then GET /v1/videos/{id}/content

Before you run it

Replace the seven briefs with your own. Confirm the model and the duration with GET /v1/videos/models, since limits differ by model. The poll response reports usage.cost for each job, so total those numbers after the first batch to learn the real weekly cost before you commit.

Then poll and review

This script only submits. Poll each polling_url until completed, or use a webhook; see the approval gate post for a verified one. For an async httpx version with many shots, see 16 shots to 16 jobs. Review each file and disclose AI use on every platform before it posts.

Sources

Related posts

More in Use cases

All Use cases posts

Written by Sume