Edit Image
Interface description: Edit images synchronously, edit based on reference images and instructions.
Before calling this interface, please request the “Image Editing Models” interface (GET /api/ai/models/image/edit) to obtain the currently available model list and the size, maximum number of input images, and price supported by each model, and then fill in the parameters of this interface accordingly.
Image editing as image-to-image: You must pass in the reference image image, and follow the prompts to modify, redraw or stylize it based on it. If you want to generate a new image (text-to-image) using only text, please use the “Generate Image” interface.
If you are already using the OpenAI SDK or ecological tools, you can use the OpenAI compatible endpoint “OpenAI Image Editing” instead.
Authorizations
Need to get API Key from AiToEarn. Click to go to "API Key Obtaining Tutorial".
Body
Image editing model name. First call the "Image Editing Models" interface (GET /api/ai/models/image/edit) and pass in the data[n].name returned by it; the size, maximum number of input images and price supported by each model shall be subject to the return of this interface.
"gpt-image-2"
Original image. Supports a single image URL, data URL, or an array of image URLs; gpt-image-2 currently supports up to 14 input images.
"https://images.unsplash.com/photo-1592194996308-7b43878e84a6?auto=format&fit=crop&w=1024&q=80"
Edit description
1 - 4000"Edit the provided image into a cozy realistic scene by placing the cute orange cat beside a sunlit window. Preserve its orange fur, seated pose, and facial expression, enhance the soft natural light, add warm tones and subtle detail, and maintain a realistic photography style."
Mask image URL for partial redraw (optional). It needs to be a PNG image with the same size as image: the completely transparent area (alpha is 0) represents the part that needs to be redrawn according to the prompt word, and the opaque area remains unchanged. Edit the entire image when not uploading.
Number of images generated
1 <= x <= 11
Image size. The optional values vary from model to model, and are subject to the data[n].sizes returned by the "Image Editing Models" interface; the prices for different sizes are different, see data[n].pricing. This example uses 1024x1024, the lowest-priced size at 1 credit.
"1024x1024"
Return format
url, b64_json "url"
Response
The request has been processed by the service. Business success is determined by whether the response body has code === 0.

