跳转到主要内容
万相2.5

Wan 2.5 — 查询结果

查询 Wan 2.5 图像编辑任务状态

GET
/tasks/{task_id}
cURL - 查询任务结果
# 将 {task_id} 替换为提交响应中返回的实际任务 ID
curl -X GET 'https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"
{
  "request_id": "d1f2a1be-9c58-48af-b43f-xxxxxx",
  "output": {
    "task_id": "7f4836cd-1c47-41b3-b3a4-xxxxxx",
    "task_status": "SUCCEEDED",
    "submit_time": "2025-09-23 22:14:10.800",
    "scheduled_time": "2025-09-23 22:14:10.825",
    "end_time": "2025-09-23 22:15:23.456",
    "results": [
      {
        "orig_prompt": "Change the floral dress to a vintage-style lace long dress with exquisite embroidery details on the collar and cuffs.",
        "actual_prompt": "Replace the pink pleated dress with a vintage-style lace long dress with exquisite embroidery details on the collar and cuffs. Keep the person's hairstyle, makeup, and posture unchanged. The overall style should be consistent with the soft tones and classic atmosphere of the original image.",
        "url": "https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.png?Expires=xxx"
      }
    ],
    "task_metrics": {
      "TOTAL": 1,
      "FAILED": 0,
      "SUCCEEDED": 1
    }
  },
  "usage": {
    "image_count": 1
  }
}
查询任务状态和结果。

轮询策略

  1. 通过创建任务接口提交请求,获取 task_id
  2. 10 秒轮询一次,直到 task_statusSUCCEEDEDFAILED
  3. 任务成功后,results 中包含图片下载 URL。

注意事项

  • URL 有效期:图片 URL 在 24 小时后过期,请及时下载。
  • 任务状态流转PENDINGRUNNINGSUCCEEDEDFAILED
  • 其他状态CANCELED(任务已取消)、UNKNOWNtask_id 无效或已过期)。
  • task_id 有效期task_id 有效期为 24 小时,过期后无法查询任务状态和结果。
  • 避免重复提交:请通过轮询获取结果,不要重复提交请求。
  • 部分失败:当 n > 1 时,只要有一张图片生成成功,任务状态即为 SUCCEEDED。失败的图片会在 results 中包含错误详情,仅成功的图片计入用量。

鉴权

string
header
必填

千问云 API Key。详见获取 API Key

路径参数

string
必填

图像编辑创建接口返回的任务标识符。

响应

200-application/json
string

请求的唯一标识符。

object
object

输出统计信息。仅统计成功生成的结果。