Authorization header.
POST /v1/images/generations
Generate one or more images from a text prompt.Request body
The model to use for image generation. For example,
dall-e-3 or dall-e-2. The available values depend on which channels you have configured.A text description of the image you want to generate. For DALL·E 3, the maximum length is 4,000 characters; for DALL·E 2 it is 1,000 characters.
Number of images to generate. Defaults to
1. DALL·E 3 only supports n=1.The dimensions of the generated image. Accepted values vary by model:
- DALL·E 2:
256x256,512x512,1024x1024 - DALL·E 3:
1024x1024,1024x1792,1792x1024
1024x1024.Image quality. Set to
hd for higher detail at higher cost (DALL·E 3 only). Defaults to standard.Format for the returned image data. Either
url (a temporary hosted URL) or b64_json (base64-encoded image bytes). Defaults to url.Style of the generated image.
vivid (hyper-real) or natural (more realistic). DALL·E 3 only.Background style for the generated image, if supported by the upstream provider.
Output file format, if supported by the upstream provider (e.g.,
png, webp).Compression level for the output image, if supported by the upstream provider. Range is
0–100.Whether to include a watermark, if supported by the upstream provider.
Response
Unix timestamp for when the request was processed.
Array of generated image objects.
Example
POST /v1/images/edits
Edit an existing image using a text prompt. You upload the source image as a multipart form, optionally include a mask, and provide a prompt describing the desired change.Request body
This endpoint usesmultipart/form-data encoding.
The model to use for image editing. For example,
dall-e-2. Not all image models support editing.The source image to edit. Must be a valid PNG file, less than 4 MB, and square.
A description of the edits you want to apply.
An optional mask image. Transparent areas of the mask indicate where the edit should be applied. Must be the same size as
image.Number of edited images to generate. Defaults to
1.Size of the output image. Accepted values:
256x256, 512x512, 1024x1024. Defaults to 1024x1024.Either
url or b64_json. Defaults to url.Response
Same structure as/v1/images/generations.
Example
curl