POST
/api/v1/gpt-image-2/generateImage Editing (GPT-2)
Edit and transform images using GPT Image 2. Supports up to 14 reference images for editing, inpainting, style transfer, and composition.
Overview
Provide one or more reference images alongside a text prompt to guide edits. You can use base64-encoded images, image URLs, or a combination of both. GPT Image 2 excels at localized edits with detail preservation.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Describe the desired edits to apply |
imageBase64 | array | Alt | Array of base64-encoded reference images (up to 14) |
imageUrls | array | Alt | Array of reference image URLs (up to 14) |
size | string | No | Output size. Default: "1024x1024" |
quality | string | No | "low", "medium", "high", or "auto" (default) |
outputFormat | string | No | "png" (default), "jpeg", or "webp" |
At least one of imageBase64 or imageUrls is required for image editing.
Example Request
bash
curl -X POST https://eccoapi.com/api/v1/gpt-image-2/generate \
-H "Authorization: Bearer nk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Change the background to a sunset beach scene",
"imageUrls": ["https://example.com/product-photo.jpg"],
"size": "1024x1024",
"quality": "high"
}'