Skip to main content
POST
/
api
/
ai
/
image
/
generate
/
async
Generate Image Async
curl --request POST \
  --url https://aitoearn.cn/api/ai/image/generate/async \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "prompt": "<string>",
  "model": "<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
prompt
string
required

Image description tips

Required string length: 1 - 4000
model
string
required

Image generation model name. First call the "Image Generation Model" interface (GET /api/ai/models/image/generation) and pass in the data[n].name returned by it; the size, quality, style and price supported by each model shall be subject to the return of this interface.

n
integer

Number of images generated

Required range: 1 <= x <= 10
quality
string

Image quality. The optional values ​​vary from model to model, and are subject to the data[n].qualities returned by the "Image Generation Model" interface.

response_format
enum<string>

Return format

Available options:
url,
b64_json
size
string

Image size. The optional values ​​vary with the model, and are subject to the data[n].sizes returned by the "Image Generation Model" interface; the prices for different sizes are different, see data[n].pricing.

style
string

Image style. The optional values ​​vary with the model, and are subject to the data[n].styles returned by the "Image Generation Model" interface; returning empty means that the model does not support style parameters.

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.