Create image

Creates an image given a prompt. Internally routes to a chat completions model with image generation capabilities.

post/v1/images/generations

Request body

promptstring required

A text description of the desired image(s).

modelstring

The model to use for image generation. Defaults to auto which selects an appropriate image generation model.

ninteger

The number of images to generate. Must be between 1 and 10.

sizestring

The size of the generated images. Supported sizes depend on the model and provider.

quality'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto'

The quality of the image that will be generated. Supported values depend on the model and provider.

response_format'b64_json'

The format in which the generated images are returned. Only b64_json is supported since images are generated via chat completions models.

style'vivid' | 'natural'

The style of the generated images.

aspect_ratiostring

The aspect ratio of the generated images (e.g. '1:1', '16:9', '4:3', '5:4'). Takes precedence over size if both are provided.

Example request

{
  "prompt": "A white siamese cat",
  "model": "gemini-3.1-flash-image-preview",
  "n": 1,
  "size": "1024x1024",
  "quality": "standard",
  "response_format": "b64_json",
  "style": "vivid",
  "aspect_ratio": "16:9"
}

Response

Image generation response.

creatednumber required

Changes

No recorded changes to this endpoint across all 1 revision of this API.