Create image
/v1/images/generationsCreate an image from text, or create/edit an image from text plus one or more input images.
Image generation responses are returned directly from this request; unlike video generation, there is no submit-and-poll task flow.
Use the returned data[].url to download the image directly. To use the dedicated image download or delete endpoints, first retrieve the image record ID from GET /v1/images.
Authentication
Authorization Bearer
API key as bearer token in Authorization header.
Request Body
modelstringrequiredModel ID.
promptstringrequiredImage generation prompt.
nintegerNumber of images to generate.
sizestringRequested output image dimensions, such as width-by-height, when the model uses explicit image size values.
aspect_ratiostringRequested output image shape as a width-to-height ratio.
resolutionstringRequested output image resolution or resolution tier.
qualitystringRequested generation quality or fidelity tier.
seedintegerOptional numeric seed for repeatable generation when deterministic seeding is supported.
prompt_extendbooleanPrompt extension flag.
negative_promptstringNegative prompt.
watermarkbooleanControls whether generated images include a watermark when supported.
response_formatstringResponse format.
imagesarrayReference images.
sequential_image_generationstringSequential image generation mode.
sequential_image_generation_optionsobjectSequential image generation configuration.
sequential_image_generation_options.max_imagesintegerMaximum number of images to generate in sequential mode.
optimize_prompt_optionsobjectPrompt optimization configuration.
optimize_prompt_options.modestringPrompt optimization mode, such as standard or fast.
strengthnumberInput image influence strength.
enable_interleavebooleanInterleaved generation flag.
enable_web_searchbooleanWeb search flag.
output_formatstringRequested file format for generated image outputs.
streambooleanStreaming response flag.
metadataobjectApplication metadata.
extra_bodyobjectAdditional request body fields.
provider_optionsobjectUpstream configuration.
moderationstringContent moderation strictness for generated images.
partial_imagesintegerNumber of partial images emitted before the final image in streaming mode
maskstringOptional mask image for image edits. Transparent areas indicate where the input image may be edited.
bbox_listarrayPer-input-image bounding boxes for interactive image editing.
enable_sequentialbooleanEnables sequential image-set generation when supported by the model.
thinking_modebooleanEnables publisher thinking mode for image generation.
color_palettearrayCustom output color palette entries with publisher-defined colors and ratios.
backgroundstringBackground handling for generated images, such as auto, transparent, or opaque.
layer_decompositionbooleanWhether the publisher should decompose the generated image into editable layers.
output_compressionintegerOutput image compression percentage for formats that support compression.
input_fidelitystringHow closely an image edit should preserve details from the input images.
userstringStable end-user identifier forwarded to publishers that accept it.
thinking_levelstringPublisher thinking level used while generating an image.
include_thoughtsbooleanWhether the publisher should include thought summaries in the response.
enable_image_searchbooleanWhether Google Search grounding may use image search results.
media_resolutionstringPublisher media-resolution tier used when processing input media.
Response
createdintegerUnix timestamp.
modelstringModel identifier that served the request.
dataobject[]Generated images.
data.urlstringURL to download the generated image.
data.b64_jsonstringBase64-encoded image when returned by the model.
data.output_formatstringOutput image format when returned by the model, for example jpeg or png.
data.sizestringOutput image dimensions when returned by the model, in <width>x<height> format.
data.errorobject | nullPer-image error details for failed image generations.
usageobjectUsage stats for the request. The usage structure varies by model. All fields below are optional and appear only when returned by the selected model.
usage.generated_imagesintegerNumber of images successfully generated by the model.
usage.input_imagesintegerNumber of input reference images.
usage.prompt_tokensintegerInput token count used by models with OpenAI Chat-style naming.
usage.completion_tokensintegerOutput token count used by models with OpenAI Chat-style naming.
usage.input_tokensintegerInput tokens consumed by the request.
usage.output_tokensintegerOutput tokens consumed by the request.
usage.total_tokensintegerTotal tokens consumed by the request.
usage.input_tokens_detailsobjectInput token counts by modality.
usage.output_tokens_detailsobjectOutput token counts by modality.
usage.output_text_tokensintegerFlattened text output token count.
usage.output_image_tokensintegerFlattened image output token count.
usage.generated_images_countintegerCompatibility field for the generated image count.
usage.image_countintegerCompatibility field for the generated image count.
usage.resolutionstringActual output resolution tier used for generation or metering.
usage.cache_read_tokensintegerInput tokens read from cache.
usage.search_queries_countintegerSearch queries used during generation.
errorobjectRequest-level error details when an error payload is returned.
error.codestringError code.
error.messagestringError message.