pydo.images.generate()
Generated on 1 Oct 2026
from pydo version
v0.43.0
Usage
client.images.generate(
model="openai-gpt-image-1",
prompt="A cute baby sea otter floating on its back in calm blue water",
size="auto",
quality="auto",
n=1,
)Serverless inference methods can authenticate with a model access key instead of a DigitalOcean API token:
client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))Description
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.
Parameters
promptstring requiredExample:
A cute baby sea otter floating on its back in calm blue waterA text description of the desired image(s). Supports up to 32,000 characters and provides automatic prompt optimization for best results.
modelstring requiredExample:
openai-gpt-image-1The model to use for image generation.
moderationstring or null optionalExample:
autoThe moderation setting for the image generation. Supported values: low, auto.
backgroundstring or null optionalExample:
autoThe background setting for the image generation. Supported values: transparent, opaque, auto.
output_formatstring or null optionalExample:
pngThe output format for the image generation. Supported values: png, webp, jpeg.
output_compressioninteger or null optionalExample:
100The output compression level for the image generation (0-100).
ninteger requiredExample:
1The number of images to generate. Must be between 1 and 10.
qualitystring or null optionalExample:
autoThe quality of the image that will be generated. Supported values: auto, high, medium, low.
sizestring optionalThe size of the generated images. GPT-IMAGE-1 supports: auto (automatically select best size), 1536x1024 (landscape), 1024x1536 (portrait).
streamboolean or null optionalExample:
FalseIf 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.
partial_imagesinteger or null optionalExample:
1The 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.
userstring or null optionalExample:
user-1234A unique identifier representing your end-user, which can help DigitalOcean to monitor and detect abuse.
Request Sample
Response Example
More Information
See /v1/images/generations in the API reference for additional detail on responses, headers, parameters, and more.