Create an image generation task
Start an asynchronous image generation task with the simplified v2 API. The response returns the new task's ID.
The v2 API provides a streamlined interface with user-friendly parameters such as aspectRatio, mode, and named style presets, replacing the raw pixel dimensions and internal parameter names of v1.
Authorization
bearerAuth In all requests that require authentication
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST https://api.pixai.art/v2/image/create \ -H "Authorization: Bearer $PIXAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "modelVersionId": "1983308862240288769", "prompt": "1girl, green hair, solo, standing", "aspectRatio": "9:16", "mode": "standard", "batchSize": 4, "seed": 12345 }'{
"id": "string",
"status": "waiting",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"startedAt": "2019-08-24T14:15:22Z",
"endAt": "2019-08-24T14:15:22Z",
"taskKind": "string",
"paidQuota": 0,
"taskStatusMsgI18n": {
"key": "string",
"defaultMessage": "string"
},
"outputs": {
"videoMediaId": "string",
"seed": "string",
"mediaIds": [
"string"
],
"mediaUrls": [
"string"
]
}
}{
"defined": false,
"code": "BAD_REQUEST",
"status": 400,
"message": "Input validation failed",
"data": {
"issues": [
{
"code": "custom",
"path": [],
"message": "Either modelId or modelVersionId must be provided"
}
]
}
}{
"code": "string",
"status": 0,
"message": "string",
"data": {},
"defined": true
}{
"code": "string",
"status": 0,
"message": "string",
"data": {},
"defined": true
}{
"code": "string",
"status": 0,
"message": "string",
"data": {},
"defined": true
}{
"code": "string",
"status": 0,
"message": "string",
"data": {},
"defined": true
}{
"code": "string",
"status": 0,
"message": "string",
"data": {},
"defined": true
}