Skip to main content

Edit Image

POST /v1/images/edits/

Request Parameters​

ParameterTypeRequiredDescription
imagefileRequiredp 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.
maskfileOptionalp 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.
promptstringRequiredp p-0 A text description of the desired image. Maximum length is 1000 characters.
nstringOptionalp p-0 Number of images to generate. Must be between 1 and 10.
sizestringOptionalp p-0 Size of the generated image. Must be one of 256x256, 512x512, or 1024x1024.
response_formatstringOptionalp p-0 Format of the generated image response. Must be url or b64_json.
userstringOptionalp p-0 A unique identifier for the end user, helping OpenAI monitor and detect abuse.
modelstringRequired-

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 NameTypeDescription