Generate and Edit Images
Create and edit images with OpenAI-compatible image endpoints, supporting multipart and JSON URL inputs.
Overview
Create new images or edit existing images using standard OpenAI image routes, supporting both standard multipart file uploads and nonstreaming JSON image URL inputs for gpt-image-2.
Image Generation
POST
/v1/images/generations- Canonical endpoint:
POST /v1/images/generations(operationId: openai.images.generations) creates images from a text prompt. - Generation parameters: Accepts
prompt, optionalmodel,n,quality, andsize. - Compatibility alias: Accepts
POST /openai/v1/images/generations(operationId: openai.images.generations.alias).
Image Editing
POST
/openai/v1/images/edits{
"model": "gpt-image-2",
"prompt": "Combine these reference images into a coherent surreal portrait.",
"images": [
{ "image_url": "https://cdn.example.com/reference-1.png" },
{ "image_url": "https://cdn.example.com/reference-2.png" }
],
"mask": {
"image_url": "https://cdn.example.com/mask.png"
},
"n": 1,
"quality": "medium",
"size": "1024x1024"
}- Canonical endpoint:
POST /openai/v1/images/edits(operationId: openai.images.edits) with compatibility aliasPOST /v1/images/edits(operationId: openai.images.edits.alias). - Multipart file uploads: Send
multipart/form-datawith originalimagefile and optionalmaskfile. - JSON URL input: For
gpt-image-2and supported native upstreams, send nonstreaming JSON withmodel,prompt, animagesarray containing 1 to 16 objects withimage_url, and an optionalmaskobject (image_url). - Public HTTPS requirements: Image URLs must use public HTTPS without embedded credentials, read directly by the upstream provider.
- Quality and size parameters:
gpt-image-2defaults quality tomedium(lowandhighare also supported); additional native parameters pass through intact.