Batches
A batch sends up to 1000 video and image requests in one call, at the batch price (the model's batch_multiplier times the standard price, half by default). Batch jobs run when GPUs are free, within a completion window you choose. Use a batch for work that does not need an answer in minutes.
Create a batch
Each request has your own custom_id (unique in the batch), the url it would be sent to, and the body that endpoint takes. The batch needs an Idempotency-Key like any create.
curl -X POST https://api.superveo.io/v1/batches \
-H "Authorization: Bearer $SUPERVIDEO_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"custom_id": "poster-1",
"url": "/v1/images/generations",
"body": {
"model": "z-image",
"prompt": "a poster of a red kite",
"size": "1024x1024"
}
},
{
"custom_id": "poster-2",
"url": "/v1/images/generations",
"body": {
"model": "flux2-klein",
"prompt": "a red kite, watercolour",
"aspect_ratio": "3:4"
}
}
],
"completion_window": "24h"
}'import os, uuid, requests
r = requests.request(
"POST", "https://api.superveo.io/v1/batches",
headers={
"Authorization": f"Bearer {os.environ['SUPERVIDEO_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()), # keep it to retry safely
},
json={
"requests": [
{
"custom_id": "poster-1",
"url": "/v1/images/generations",
"body": {
"model": "z-image",
"prompt": "a poster of a red kite",
"size": "1024x1024"
}
},
{
"custom_id": "poster-2",
"url": "/v1/images/generations",
"body": {
"model": "flux2-klein",
"prompt": "a red kite, watercolour",
"aspect_ratio": "3:4"
}
}
],
"completion_window": "24h"
},
)
print(r.status_code, r.json())const r = await fetch("https://api.superveo.io/v1/batches", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SUPERVIDEO_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(), // keep it to retry safely
"Content-Type": "application/json",
},
body: JSON.stringify({
"requests": [
{
"custom_id": "poster-1",
"url": "/v1/images/generations",
"body": {
"model": "z-image",
"prompt": "a poster of a red kite",
"size": "1024x1024"
}
},
{
"custom_id": "poster-2",
"url": "/v1/images/generations",
"body": {
"model": "flux2-klein",
"prompt": "a red kite, watercolour",
"aspect_ratio": "3:4"
}
}
],
"completion_window": "24h"
}),
});
console.log(r.status, await r.json());It is all or nothing: either every request is valid and the whole batch is paid for (held), or nothing is created and the answer is 400 invalid_batch; metadata.details lists every bad request by its index and custom_id. The 202 answer is a batch with data, one entry per request with the job it created:
{
"id": "batch_5e0a...",
"object": "batch",
"status": "in_progress",
"completion_window": "24h",
"price_multiplier": 0.5,
"request_counts": {"total": 2, "queued": 2, "in_progress": 0, "completed": 0, "failed": 0, "cancelled": 0},
"max_cost_usd": 0.004,
"data": [
{"custom_id": "poster-1", "id": "img_...", "object": "image", "status": "queued", "polling_url": "..."},
{"custom_id": "poster-2", "id": "img_...", "object": "image", "status": "queued", "polling_url": "..."}
]
}
(Shortened.) completion_window is 1h to 24h, default 24h. Requests not started by then are cancelled and cost nothing.
Follow a batch
GET /v1/batches/{id}: the batch withrequest_countsand the cost so far. Read it everypoll_after_ms.GET /v1/batches/{id}/requests: its jobs, in the order you sent them, as normal job objects with yourcustom_id. Page withlimitandafter.- Each job can also be read, streamed and downloaded on its own, as in How jobs work.
The batch's status is in_progress until every job is final, then completed. Requests the window ended before they started are counted in request_counts.cancelled. After a cancel the status is cancelling until the requests already generating finish, then cancelled.
Cancel a batch
POST /v1/batches/{id}/cancel cancels the requests still queued and releases their hold. Requests already generating finish and are billed.
Price a batch first
POST /v1/quote with "url": "/v1/batches" and the batch body returns the price of every request and the total it would hold. Nothing is created:
curl -X POST https://api.superveo.io/v1/quote \
-H "Authorization: Bearer $SUPERVIDEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "/v1/batches",
"body": {
"requests": [
{
"custom_id": "a",
"url": "/v1/images/generations",
"body": {
"model": "qwen-image",
"prompt": "a cat"
}
}
]
}
}'import os, uuid, requests
r = requests.request(
"POST", "https://api.superveo.io/v1/quote",
headers={
"Authorization": f"Bearer {os.environ['SUPERVIDEO_API_KEY']}",
},
json={
"url": "/v1/batches",
"body": {
"requests": [
{
"custom_id": "a",
"url": "/v1/images/generations",
"body": {
"model": "qwen-image",
"prompt": "a cat"
}
}
]
}
},
)
print(r.status_code, r.json())const r = await fetch("https://api.superveo.io/v1/quote", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SUPERVIDEO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"url": "/v1/batches",
"body": {
"requests": [
{
"custom_id": "a",
"url": "/v1/images/generations",
"body": {
"model": "qwen-image",
"prompt": "a cat"
}
}
]
}
}),
});
console.log(r.status, await r.json());