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.

5 min readSume
All posts

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.

n ceilings in the Sume image catalog, read 2026-10-06
ModelMax n per callSource
Most catalog models, e.g. bytedance-seed/seedream-4.54n range descriptor
x-ai/grok-image1n range descriptor
higgsfield/soulBatches of 1 or 4Catalog constraint text
Any model on a 10-image requestRejected above the model's maxPer-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

All Developers posts

Written by Sume