Anime series by API: a job-queue pattern on Sume
Pika's API Club spotlights show members making anime and dramas by API. A series needs a queue: idempotent submits, polling, and a webhook as a fast path.

To build a series by API, treat every shot as a job in a queue: submit with a stable idempotency key, record the job id, and collect the result by webhook or polling. The Pika blog of Sep 24, 2026 spotlights three API Club members making anime, dramas and tools; the queue below uses Sume's documented video endpoint.
Why a queue
A series is dozens of shots. A crash halfway through a script that submits shots in a loop leaves you unsure which were paid for. The Sume video route supports Idempotency-Key, and a replay returns the original job, so deriving the key from episode and shot number makes the loop safe to restart.
The Sume endpoints
| Step | Call | Notes |
|---|---|---|
| Submit | POST /v1/videos | Send Idempotency-Key; response has id and polling_url |
| Push result | callback_url in the body | HTTPS only; signed job event |
| Poll | GET /v1/videos/{jobId} or GET /v1/jobs/{id}/status | Stop on completed or failed |
| Download | GET /v1/videos/{jobId}/content | index defaults to 0 |
A small runnable queue
This script submits shots with deterministic keys, then polls each polling URL. Run it twice and the second run reuses the same jobs.
import os, time, requests
BASE = "https://api.sume.com/v1/videos"
H = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}
shots = {
"ep01-s01": "Anime style: a courier runs across neon rooftops at dusk",
"ep01-s02": "Anime style: she stops at the edge and looks at the skyline",
}
jobs = {}
for key, prompt in shots.items():
r = requests.post(BASE, json={"model": "sume/auto", "prompt": prompt, "aspect_ratio": "16:9", "duration": 5},
headers={**H, "Idempotency-Key": key})
r.raise_for_status()
jobs[key] = r.json()["polling_url"]
while jobs:
for key, url in list(jobs.items()):
s = requests.get(url, headers=H).json()
if s["status"] in ("completed", "failed"):
print(key, s["status"])
del jobs[key]
time.sleep(30)Webhook as the fast path
Pass callback_url and Sume POSTs a signed terminal job event. Return a 2xx after storing it, use job_id as your idempotency key, and keep polling as a backup, since ten failed delivery attempts do not change the job's real state. Sume does not claim character consistency across shots from this pattern; that is a prompting and reference-image question, not a queue question.
Sources
Related posts
More in Use cases
- 100 holiday videos in one Sume bulk run: how long with concurrency 16
A bulk queue of 100 items at concurrency 16 drains in 7 waves. Wave arithmetic from the docs' 15 to 30 minute long-form figure, and what else caps the window.
- Christmas ad music: an instrumental Lyria brief that sells
A Christmas ad needs music that is festive without vocals under the voiceover. Brief it in one prompt, set the bed under speech and fade it out, with Sume.
- Clean a transcript with a 2,000-character instruction, then caption
ElevenLabs speech to text can edit a transcript from a natural-language instruction up to 2,000 characters. A cleanup then captions workflow with Sume captions.
- Article 50: creator duties vs provider duties, side by side
Article 50(4) puts deepfake and certain text disclosure on deployers, while 50(2) puts marking on providers. A two-column split for teams that publish AI video.
Written by Sume