n above the ceiling returns 400 on Sume images: split the batch
The images schema allows n up to 10, but each model's own range is lower: 4 on most, 1 on Grok Image. Read the descriptor and split the batch. Python helper.

If you send n: 5 to Seedream 4.5 on Sume's image API you get a 400 that names the allowed range, because the request schema accepts n up to 10 but each model publishes a lower ceiling: 4 on most models, 1 on Grok Image. The ceiling is the n range descriptor in GET /v1/images/models. The Image API docs call this out: use n for up to 10 images, but per-model ceilings are lower.
The fix is not a retry. Read the ceiling once, then split the batch.
Where do I read the ceiling?
Each catalog row lists supported_parameters, and n is a range descriptor with min and max. For most models that reads { "type": "range", "min": 1, "max": 4 }. Sume does not clamp or drop a value outside the range; it rejects the request, which is why the error is safe and cheap to hit.
| Model | Max n per call | Source |
|---|---|---|
| Most catalog models, e.g. bytedance-seed/seedream-4.5 | 4 | n range descriptor |
| x-ai/grok-image | 1 | n range descriptor |
| higgsfield/soul | Batches of 1 or 4 | Catalog constraint text |
| Any model on a 10-image request | Rejected above the model's max | Per-model range |
How do I split a batch?
Plan the call sizes first, then submit them. The helper below turns a total and a ceiling into call sizes and runs offline, so you can test it before any key is involved.
def plan(total: int, cap: int = 4) -> list[int]:
sizes = []
while total > 0:
sizes.append(min(cap, total))
total -= cap
return sizes
assert plan(10) == [4, 4, 2]
assert plan(6, 1) == [1, 1, 1, 1, 1, 1]
assert plan(3) == [3]
print(plan(10))
# For each size, POST /v1/images with {"n": size, ...}.
# Price is cost_usd x n either way, so splitting costs nothing extra.Does splitting change the bill?
No. Sume charges cost_usd x n, so ten images are ten times the per-image price whether you send three calls or ten. What changes is failure shape: each call is all-or-nothing, so a smaller call that fails wastes less time. Give each call its own Idempotency-Key, derived from your item id and the call index, so a retry returns the original job. Prices here are list x 1.25 in dollars per image before whole-cent rounding; the catalog's billable formula reads "list x 1.25, ceil usd cents", so confirm the first charge in usage.cost and budget from the invoice, not from the sum.
Sources
Related posts
More in Developers
- Nearest supported aspect ratio per Sume image model, in Python
A model rejects an aspect ratio it does not list. Read the catalog, pick the closest ratio it accepts, generate, then crop to the exact shape you need.
- NestJS raw body controller to verify an AI video webhook signature
Enable rawBody in NestFactory, read req.rawBody in a controller and check Sume's sume-v1 HMAC before you act on a job.completed video event.
- Never set toleranceSeconds to 0 on a Sume webhook verifier
toleranceSeconds 0 skips the timestamp check, so a captured delivery verifies forever. See the replay and a WebCrypto verifier that rejects stale ones.
- A Node CLI to submit a Sume video job: util.parseArgs and --dry-run
A Node script with util.parseArgs that validates duration, builds the /v1/videos request, and prints it with --dry-run before anything bills. Tested offline.
Written by Sume