Create Image
POST
/v1/images/generationsGenerate one or more images from a text prompt.
Request Body
application/jsonmodel:requiredenum<string>Image generation model. Use gpt-image-2-c for 1K/2K output or gpt-image-2-4k-c for 4K output.
Allowed
gpt-image-2-cgpt-image-2-4k-cExample
gpt-image-2-cprompt:requiredstringText instruction describing the requested output.
size:optionalenum<string>Output dimensions. Use a listed preset or a custom WxH value. Custom sizes must have a maximum edge of 3840 px, both edges divisible by 16, an aspect ratio no greater than 3:1, and 655,360–8,294,400 total pixels.
Allowed
1024x10241536x10242048x15361024x15361536x20481440x21602048x20482880x28803200x25602560x32003264x24482448x32643504x23362336x35043840x21602160x38403696x1584autoExample
autoResponse
200A successful request returns a JSON response. The complete example is shown in the code panel.