Sume image 400s name the valid values: retry in code
Sume's Image API 400 bodies carry details.supported, allowed, min and max. A tested error table and a small function that retries with a valid value.

When a Sume image request fails validation, the 400 body tells you what would have worked. The error envelope is {"error": {"code", "message", "request_id", "next_action", "details"}}, and for value errors details carries the field name plus the accepted list or range: supported for enums, allowed for a fixed set of integers, min and max for ranges. A client can read those and retry once with a valid value instead of failing a whole batch.
Every row in the table below was produced by running the request normalizer on origin/main with a deliberately bad value, so the messages and details keys are real, not paraphrased. The envelope fields come from the API's error handler; check the live response if you rely on a field I did not list.
Seven errors and what each one tells you
Two codes show up. invalid_request means the value is wrong for this model, and details lists what is valid. unsupported_parameter means the model does not take that parameter at all, and details.catalog_url points at /v1/images/models so you can see what it does take (Sume Image API docs).
The practical rule is that only the first kind is worth an automatic retry. An unsupported parameter should be removed from the request or fixed by choosing another model, and that is a decision for the caller.
| Request | Code | details |
|---|---|---|
| higgsfield/soul with n: 2 | invalid_request | field n, allowed [1, 4] |
| openai/gpt-image-2.5 with n: 5 | invalid_request | field n, min 1, max 4 |
| ideogram/ideogram-v4.5 with quality very_low | invalid_request | field quality, supported low, medium, high |
| ideogram/ideogram-v4.5 with resolution 4K | invalid_request | field resolution, supported 1K, 2K |
| google/imagen-4-fast with aspect_ratio 21:9 | invalid_request | field aspect_ratio, supported 1:1, 16:9, 9:16, 4:3, 3:4 |
| google/imagen-4-fast with input_references | unsupported_parameter | field input_references, catalog_url |
| google/nano-banana-2 with quality high | unsupported_parameter | field quality, catalog_url |
A one-retry repair function
The function below takes the request body and a parsed error envelope. For an enum field it swaps in the first supported value; for allowed it picks the nearest allowed integer; for a range it clamps. It returns a new body, or None when the error is not a value error it can fix. The demo at the bottom feeds it two of the real error shapes from the table.
Picking the first supported value is a deliberate placeholder. In production choose with intent: the nearest ratio, the cheapest quality, the largest allowed n. The point is the structure, because the data you need is already in the error.
def repair(body: dict, err: dict) -> dict | None:
if err.get("code") != "invalid_request":
return None
d = err.get("details") or {}
field = d.get("field")
if not field or field not in body:
return None
fixed = dict(body)
if "supported" in d:
fixed[field] = d["supported"][0]
elif "allowed" in d:
fixed[field] = min(d["allowed"], key=lambda v: abs(v - body[field]))
elif "min" in d and "max" in d:
fixed[field] = max(d["min"], min(d["max"], body[field]))
else:
return None
return fixed
print(repair({"n": 2}, {"code": "invalid_request", "details": {"field": "n", "allowed": [1, 4]}}))
print(repair({"n": 5}, {"code": "invalid_request", "details": {"field": "n", "min": 1, "max": 4}}))
print(repair({"quality": "very_low"}, {"code": "invalid_request",
"details": {"field": "quality", "supported": ["low", "medium", "high"]}}))Where not to auto-repair
Do not repair silently when the value change alters the price or the output. Moving Ideogram from very_low to low changes cost; reducing n from 5 to 4 changes how many images you get. Log the change, and for billed workloads keep the repair behind a flag. If you want the background on one error family, see GPT Image 2.5 unsupported_parameter 400.
Two codes should never be retried unchanged: streaming_not_supported (omit stream) and unknown-model 404 model_not_found. Both need a different request, not the same one again.
Sources
Related posts
More in Developers
- Sort Sume image models by created? The field is one shared value
GET /v1/images/models returns the same created timestamp for every model, so it cannot tell you which is newest. What to use instead, with a script to prove it.
- Sume SDK error.retryable: server flag first, status only as fallback
SumeApiError.retryable uses the error envelope's retryable flag when present and falls back to 408, 429 or 5xx otherwise. A 409 is never retried by status.
- Sume uploadFile with raw bytes needs a content type, or no request
uploadFile refuses a Uint8Array or ArrayBuffer without contentType and throws SumeUploadError at step create before any call. Pass a typed Blob or a MIME.
- Patching Supabase Postgres 17.11 vs Sume's 10-attempt webhook budget
Supabase's September 25 Postgres 15.19 and 17.11 releases fix 44 CVEs. A restart can outlast Sume's ten 30-second webhook attempts, so plan a redeliver.
Written by Sume