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
- Lobby and elevator announcements with AI voice: 12 messages for $0.09
Twelve recorded building announcements at about 150 characters each cost $0.0855 on Sume TTS. How to batch them, vary languages and reuse the files.
- 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.
- Dubbed video: burn target-language captions with script_text
After dubbing into Spanish or German, caption the new audio with your translated script as script_text so burned words match your approved translation.
- CAWG identity assertion 1.2: who made it, not whether it is AI
A CAWG identity assertion says which named actor stands behind an asset. It does not say the asset is AI-generated. What Sume stores that you can pair with it.
Written by Sume