POST /v1/images/generations (and
POST /v1/images/edits). See Image Generation for the
full reference.
size / quality value rejected
Valid values differ by model.quality is low/medium/high for GPT image
(plus xhigh/max on gpt-image-2.5-*), 1K/2K/4K for Gemini 3 image, or
auto. size accepts dimensions or aspect ratios (e.g. 1024x1024,
1536x1024) or auto. n must be 1–10.
I got base64 back when I asked for a URL (Vertex AI, GPT image)
Vertex AI (Gemini image, Imagen) and GPT image models return image bytes, not a hosted link. With the defaultresponse_format: "url" the url field holds a
data:image/...;base64, URI; pass b64_json to get the raw base64 in
b64_json. Imagen does not return token usage, so don’t rely on usage
being present.
output_format has no effect
output_format (png / jpeg / webp) is honoured only by providers that
take it: GPT image models (OpenAI, Azure) and BytePlus Seedream (png /
jpeg only), among others. output_compression is GPT image only. Providers
that don’t support a field ignore it.
Streaming request looks stuck
Withstream: true you get a text/event-stream. On most models the early
chunks are keep-alive (status: "processing") plus : ping comments to hold the
connection open during long generations. Wait for the chunk carrying
data[].url (or b64_json); the stream then ends with data: [DONE].
BytePlus Seedream 4.0, 4.5 and 5.0 stream natively instead. Each image arrives as
an image_generation.partial_succeeded event with url or b64_json at the top
level, and the stream ends with image_generation.completed, with no
data: [DONE]. See Streaming.
422 on an edit: operation not supported
Theoperation (edit, remove_background, upscale, outpaint, inpaint,
mix, reframe) must be one the chosen model serves. Check its
image_operations on GET /v1/models. An unsupported operation returns
422. inpaint also requires a mask the same size as the image.
501 Not Implemented
The model’s provider has no image-generation (on/v1/images/generations) or
image-edit (on /v1/images/edits) support, or the model isn’t an image model.
Pick a model whose output_modalities includes image.