EccoAPIeccoapi
POST/api/v1/gpt-image-2/generate

Image 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

ParameterTypeRequiredDescription
promptstringYesDescribe the desired edits to apply
imageBase64arrayAltArray of base64-encoded reference images (up to 14)
imageUrlsarrayAltArray of reference image URLs (up to 14)
sizestringNoOutput size. Default: "1024x1024"
qualitystringNo"low", "medium", "high", or "auto" (default)
outputFormatstringNo"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"
  }'