Skip to main content
GET
/
tasks
/
{task_id}
Retrieve image task
curl --request GET \
  --url https://dimilinks.com/v1/tasks/{task_id} \
  --header 'Authorization: Bearer <token>'
{
  "id": "img_xxx",
  "task_id": "img_xxx",
  "object": "image.task",
  "status": "queued",
  "progress": 50,
  "created_at": 123,
  "completed_at": 123,
  "result": {
    "created": 1777080000,
    "task_id": "img_xxx",
    "data": [
      {
        "url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
        "file_id": "file_xxx"
      }
    ]
  },
  "error": {
    "message": "<string>",
    "type": "invalid_request_error",
    "code": "<string>"
  }
}
提交异步图片任务后,用 task_id 查询任务状态。新接入请优先使用 /v1/tasks/{task_id}

请求

curl "https://dimilinks.com/v1/tasks/img_xxx" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY"

进行中响应

{
  "id": "img_xxx",
  "task_id": "img_xxx",
  "object": "image.task",
  "status": "in_progress",
  "progress": 50,
  "created_at": 1777080000
}

成功响应

{
  "id": "img_xxx",
  "task_id": "img_xxx",
  "object": "image.task",
  "status": "succeeded",
  "progress": 100,
  "created_at": 1777080000,
  "completed_at": 1777080060,
  "result": {
    "created": 1777080000,
    "data": [
      {
        "url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
        "file_id": "file_xxx"
      }
    ]
  }
}

失败响应

{
  "id": "img_xxx",
  "task_id": "img_xxx",
  "object": "image.task",
  "status": "failed",
  "progress": 100,
  "created_at": 1777080000,
  "completed_at": 1777080060,
  "error": {
    "code": "upstream_error",
    "message": "上游返回错误"
  }
}

状态

状态含义调用方建议
queued等待处理继续轮询。
in_progress生成中继续轮询。
succeeded已完成展示 result.data[].url
failed已失败展示错误信息,并允许用户重试。

历史路径

GET /v1/images/tasks/{task_id} 保留给旧客户端。新接入不要混用两个查询结构。 历史路径响应示例:
{
  "task_id": "img_xxx",
  "status": "success",
  "conversation_id": "conv_xxx",
  "created": 1777080000,
  "finished_at": 1777080060,
  "error": "",
  "credit_cost": 123,
  "data": [
    {
      "url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
      "file_id": "file_xxx"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

task_id
string
required

Response

Image task

id
string
Example:

"img_xxx"

task_id
string
Example:

"img_xxx"

object
string
Example:

"image.task"

status
enum<string>
Available options:
queued,
in_progress,
succeeded,
failed
progress
integer
Required range: 0 <= x <= 100
created_at
integer
completed_at
integer
result
object
error
object