Images

Create image from text prompt

POST /v1/images/generations

post/api/v1/images/generations

Request

  • Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/v1/images/generations
  • Auth: HTTP bearer

Request body

background'transparent' | 'opaque' | 'auto'

Image background transparency (GPT image models only)

modelstring nullable

The model to use for image generation.

moderation'low' | 'auto'

Content moderation level (GPT image models only)

ninteger nullable

Number of images to generate (1-10). For dall-e-3, only n=1 is supported.

output_compressioninteger nullable

Compression level (0-100%) for webp/jpeg output. GPT image models only.

output_format'png' | 'jpeg' | 'webp'

Image output format (GPT image models only)

promptstring required

A text description of the desired image(s). Max 32000 chars for GPT image models, 1000 for dall-e-2, 4000 for dall-e-3.

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

Image quality setting

response_format'url' | 'b64_json'

Image response format

size'auto' | '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | '1792x1024' | '1024x1792'

Image size for generation

streamboolean nullable

Generate image in streaming mode. GPT image models only.

style'vivid' | 'natural'

Image style (dall-e-3 only)

userstring nullable

Unique identifier for the end-user for abuse detection.

Response

Image generated successfully

backgroundstring nullable

Background used (transparent or opaque)

createdinteger required

Unix timestamp (seconds) when images were created

output_formatstring nullable

Output format used (png, webp, jpeg)

qualitystring nullable

Quality of generated images

sizestring nullable

Size of generated images

Changes

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