Skip to content

Create gpt-image-2

POST
/v1/images/generations
  • Generate images from a text prompt (gpt-image-2)
  • Supports output parameters such as size, format, and quality
  • Request body is application/json
  • Official docs: Images create

Authorizations

bearer
Type
HTTP (bearer)

Request Body

application/json
object

Model used to generate images, e.g. gpt-image-2.

A text description of the desired image. Maximum length is 1000 characters.

Number of images to generate. Must be between 1 and 10.

Image dimensions
1024x1024 square
1536x1024 landscape
1024x1536 portrait
2048x2048 2K square
2048x1152 2K landscape
3840x2160 4K landscape
2160x3840 4K portrait
auto default

Size constraints

  1. Maximum edge length ≤ 3840px
  2. Both width and height must be multiples of 16px
  3. Long edge / short edge ratio ≤ 3:1
  4. Total pixels: minimum 655360 ~ maximum 8294400

Image format
Options: png, jpeg, webp

Image quality
Options: low, medium, high, auto (default)

Responses

application/json
object
object[]
Required
object
Required

Playground

Authorization
Body

Samples