Edit Image
POST /v1/images/edits/
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
image | file | Required | p p-0 The image to edit. Must be a valid PNG file, under 4 MB, and square. If no mask is provided, the image must have transparency which will be used as the mask. |
mask | file | Optional | p p-0 An additional image whose fully transparent areas indicate where the image should be edited. Must be a valid PNG file, under 4 MB, and the same size as the original image. |
prompt | string | Required | p p-0 A text description of the desired image. Maximum length is 1000 characters. |
n | string | Optional | p p-0 Number of images to generate. Must be between 1 and 10. |
size | string | Optional | p p-0 Size of the generated image. Must be one of 256x256, 512x512, or 1024x1024. |
response_format | string | Optional | p p-0 Format of the generated image response. Must be url or b64_json. |
user | string | Optional | p p-0 A unique identifier for the end user, helping OpenAI monitor and detect abuse. |
model | string | Required | - |
Request Example
curl -L -X POST 'https://www.kaopuapi.com/v1/images/edits' \
-H 'Authorization: Bearer sk-47YdoiwPu5flGqZLkhDLX9w4cNnHMpC6bljJ8HbuZEHl1jqN' \
-F 'image=@/test/cat.jpg' \
-F 'image=@/test/dog.jpg' \
-F 'prompt=Have image1 lift image2 overhead, background on a grassy field' \
-F 'n=1' \
-F 'model=gpt-image-2' \
-F 'quality=low'
Response Fields(200)
| Field Name | Type | Description |
|---|