Skip to content

ComfyUI 特殊接口

创建任务

http
POST /v1/videos
Content-Type: application/json
Authorization: Bearer <API_KEY>

请求结构

关键字段:

  • model
  • prompt
  • nodeInfoList

示例:

json
{
  "model": "gqfd",
  "prompt": ".",
  "nodeInfoList": [
    {
      "nodeId": "308",
      "fieldName": "image",
      "fieldValue": "https://o.uguu.se/tZuuEUzB.jpg",
      "description": "上传图片"
    },
    {
      "nodeId": "306",
      "fieldName": "value",
      "fieldValue": "false",
      "description": "开启8K,默认4K"
    }
  ]
}

创建成功返回

json
{
  "id": "2013530038900760577",
  "status": "queued",
  "progress": 0,
  "created_at": 1768897945
}

轮询任务

http
GET /v1/videos/{id}
Authorization: Bearer <API_KEY>

处理中示例:

json
{
  "id": "2013530038900760577",
  "model": "gqfd",
  "progress": 0,
  "results": null,
  "status": "processing",
  "taskId": "2013530038900760577",
  "taskStatus": "RUNNING"
}

完成示例:

json
{
  "id": "2013524024470147074",
  "model": "gqfd",
  "progress": 100,
  "results": [
    {
      "outputType": "png",
      "url": "https://example.com/output.png"
    }
  ],
  "status": "completed",
  "taskId": "2013524024470147074",
  "taskStatus": "SUCCESS"
}

失败示例:

json
{
  "errorCode": "1004",
  "errorMessage": "Task not found, please check the task ID | 任务不存在或已过期,请检查任务ID",
  "id": "2013535445492834306",
  "status": "failed"
}

结果解析

  • 遍历 results
  • 读取所有 results[*].url
  • 当前高清放大场景通常只输出单图,可直接取 results[0].url

注意事项

  • prompt 字段必须保留,即使内容只是占位字符
  • 不同工作流的 nodeInfoList 定义不同,不能硬编码复用
  • 建议把最终产物转存到自有存储,避免第三方链接过期

以 VitePress 构建,由 Cloudflare Pages 发布