Skip to main content
POST
/
api
/
ai
/
image
/
edit
/
async
Edit Image Async
curl --request POST \
  --url https://aitoearn.cn/api/ai/image/edit/async \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "model": "<string>",
  "image": "<string>",
  "prompt": "<string>"
}
'
{
  "code": 0,
  "message": "Request succeeded",
  "data": {
    "logId": "string",
    "status": "generating"
  }
}

Authorizations

X-Api-Key
string
header
required

Need to get API Key from AiToEarn. Click to go to "API Key Obtaining Tutorial".

Body

application/json
model
string
required

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.

image
required

original picture

prompt
string
required

Edit description

Required string length: 1 - 4000
mask
string

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.

n
integer

Number of images generated

Required range: 1 <= x <= 1
size
string

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.

response_format
enum<string>

Return format

Available options:
url,
b64_json

Response

200 - application/json

The request has been processed by the service. Business success is determined by whether the response body has code === 0.

code
integer
required

Business status code. 0 means success; non-zero means a business error.

message
string
required

Response message.

data
object
requestId
string

Request ID.

timestamp
integer

Error response timestamp in Unix milliseconds.