← All docs

Endpoints

Generate images

POST/v1/images/generations

Image generation.

Body

modelstringYes
A model ID in the IMAGE category
promptstringYes
1–4000 characters
nintegerNo
Number of images to generate, 1–10 (default 1)
sizestringNo
256x256 · 512x512 · 1024x1024 · 1792x1024 · 1024x1792 · 1536x1024 · 1024x1536 · auto
qualitystringNo
standard · hd · low · medium · high · auto — see model-specific values and omission defaults below
response_formatstringNo
url (default) · b64_json
userstringNo
End-user identifier

Some models have a lower limit on n (see the Imagen model notes). For the image models you can use, check GET /v1/models for entries whose category is IMAGE.

Model-specific size, quality, and count

Check capabilities.image_generation, limits.max_images, limits.supported_sizes, and limits.supported_qualities in GET /v1/models. Omitted fields mean unverified support. Even a value in the shared schema returns 400 when the model does not support it.

ModelSupported values and meaning
Native Gemini imageSupports only n: 1. Explicit quality returns 400. auto/omission uses provider defaults; 1024x1024 means 1:1, 1536x1024 means 3:2, 1024x1536 means 2:3, 1792x1024 means 16:9, and 1024x1792 means 9:16. These are not guarantees of exact pixel dimensions
Gemini 3 imageThese aspect ratios use a 1K resolution request by default. 512x512 is supported only by Gemini 3.1 Flash Image; 256x256 is unsupported. Gemini 3.1 Flash-Lite Image supports 1K only
Gemini 2.5 imageUses the provider's fixed native resolution. 256x256 and 512x512 are unsupported
ImagenRegular generation supports n: 1–4; upscale uses the edit endpoint with 1. Explicit quality returns 400. Sizes are aspect-ratio aliases, not pixel guarantees: all three square sizes mean 1:1; 1536x1024 means 4:3, 1024x1536 means 3:4, 1792x1024 means 16:9, and 1024x1792 means 9:16
OpenAI GPT ImageSupports low/medium/high/auto. standardmedium and hdhigh are compatibility aliases. Omitted quality retains the existing medium default. Sizes are limited to 1024x1024, 1536x1024, 1024x1536, and auto; omission uses 1024x1024. 256x256 and 512x512 return 400 instead of being enlarged
Meta imageExplicit quality returns 400

Returns

url is a presigned URL valid for 10 minutes. To keep an image longer, download and store it yourself. Once it expires you can re-issue one through GET /v1/outputs/{requestId} for up to 24 hours.

Current model options

Loading…