POST /v1/images/generations

Creates a high-quality image from a text prompt using GPT-IMAGE-1, the latest image generation model with automatic prompt optimization and enhanced visual capabilities.

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
prompt String Yes

A text description of the desired image(s). Supports up to 32,000 characters and provides automatic prompt optimization for best results.

output_compression Integer No

The output compression level for the image generation (0-100).

stream Boolean No

If set to true, partial image data will be streamed as the image is being generated. The response will be sent as server-sent events with partial image chunks. When stream is true, partial_images must be greater than 0.

Default value: false

n Integer Yes

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

size String No

The size of the generated images. GPT-IMAGE-1 supports: auto (automatically select best size), 1536x1024 (landscape), 1024x1536 (portrait).

Valid values:

  • "auto"
  • "1024x1536"
  • "1536x1024"
quality String No

The quality of the image that will be generated. Supported values: auto, high, medium, low.

user String No

A unique identifier representing your end-user, which can help DigitalOcean to monitor and detect abuse.

moderation String No

The moderation setting for the image generation. Supported values: low, auto.

partial_images Integer No

The number of partial image chunks to return during streaming generation. Defaults to 0. When stream=true, this must be greater than 0 to receive progressive updates of the image as it is being generated.

background String No

The background setting for the image generation. Supported values: transparent, opaque, auto.

output_format String No

The output format for the image generation. Supported values: png, webp, jpeg.

model String Yes

The model to use for image generation.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.