← All docs

POST /v1/images/generations

Image generation. n is at most 10.

Image generation.

Parameters

ParameterTypeRequiredDescription
modelstringYesA model ID in the IMAGE category
promptstringYes1–4000 characters
nintegerNoNumber of images to generate, 1–10 (default 1)
sizestringNo256x256 · 512x512 · 1024x1024 (default) · 1792x1024 · 1024x1792 · 1536x1024 · 1024x1536 · auto
qualitystringNostandard (default) · hd · low · medium · high · auto — mapped or ignored depending on the backend
response_formatstringNourl (default) · b64_json
userstringNoEnd-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.

Request

{
  "model": "<IMAGE model ID from GET /v1/models>",
  "prompt": "a beautiful sunset over mountains",
  "n": 1
}

Response

{
  "created": 1709884800,
  "data": [
    { "url": "https://..." }
  ]
}

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.