Asynchronous Image Generation API Reference
For long-running image models: submit a task to get task_id, then poll for results. Request body matches the sync image endpoints (JSON or multipart/form-data).
Example model
Examples below use dall-e-3 (DALL·E 3). Replace model and adjust size, quality, etc. per console docs when switching models.
Create task
https://token.easyapi.com/v1/images/tasksSubmit an async image job; returns task_id and initial status immediately. Body fields match sync endpoints (text-to-image / image-to-image); supports application/json or multipart/form-data.
Request parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Authorization | header | string | Yes | EasyAPI API Key. Format: Bearer `API_KEY` |
Content-Type | header | string | Yes | application/json or multipart/form-data |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Image model ID, same as sync endpoints |
prompt | string | Yes | Text prompt for the image |
n | integer | No | Number of images, default 1 |
size | string | No | Output size within model limits |
response_format | string | No | url or b64_json when supported |
image | file | No | Reference image for image-to-image (multipart/form-data) |
Example
{
"model": "dall-e-3",
"prompt": "一只金毛犬在阳光明媚的海滩上奔跑,水彩插画风格,柔和光线",
"n": 1,
"size": "1024x1024"
}Response example
{
"code": "success",
"data": {
"task_id": "task_img_7c2f9a1b3e4d5c6a8b9f0e1d2c3a4b5",
"status": "NOT_START",
"action": "IMAGE_GENERATION",
"quota": 2000
}
}Query task
https://token.easyapi.com/v1/images/tasks/{task_id}Example request: https://token.easyapi.com/v1/images/tasks/task_img_7c2f9a1b3e4d5c6a8b9f0e1d2c3a4b5
Poll by task_id. When status is SUCCESS, data.images is a standard OpenAI Image Response array (url / b64_json / revised_prompt).
Request parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Authorization | header | string | Yes | EasyAPI API Key. Format: Bearer `API_KEY` |
task_id | string | Yes | task_id returned from create |
Response example
{
"code": "success",
"data": {
"task_id": "task_img_7c2f9a1b3e4d5c6a8b9f0e1d2c3a4b5",
"status": "SUCCESS",
"images": [
{
"url": "https://cdn.example.com/images/img_dalle3_7c2f9a1b.png",
"b64_json": "",
"revised_prompt": "A golden retriever running on a sunny beach, watercolor illustration style"
}
]
}
}