batch-video-productionlisted
Install: claude install-skill apimageorg/apimage-skills
# Batch Production
A batch is not fifteen single generations. It's a queue with a concurrency cap, a credit budget, a reconciliation problem and a review step — and getting any of those wrong turns a productive afternoon into a mess of half-finished jobs you can't account for.
## The constraints that shape a batch
| Constraint | Value |
|---|---|
| Video endpoint | **30 requests/minute** |
| Background tools | 30/minute |
| `/ai-image-generate` | 60/minute |
| `/generations`, `/brand-assets` | 120/minute |
| **Concurrent in-flight video jobs** | **Capped** (plan-dependent) |
The concurrency cap is the one that breaks naive batching. Firing twenty jobs does not queue them for you — some are rejected. Rejections aren't billed but they do leave you with a partial batch and no clear record of which specs never ran.
## The queue
```python
from collections import deque
import time
def run_batch(specs, max_inflight=3, poll_every=5, timeout=1800):
queued, inflight, done = deque(enumerate(specs)), {}, []
deadline = time.monotonic() + timeout
while (queued or inflight) and time.monotonic() < deadline:
while queued and len(inflight) < max_inflight:
idx, spec = queued.popleft()
try:
job = generate_video(**spec)
inflight[job["id"]] = (idx, spec)
except Exception as e:
queued.appendleft((idx, spec)) # rate limited? retry later
time.sleep(20)
brea