Yeehoo 开发者

获取任务

统一查询图片、视频等异步任务状态,是生产环境最推荐使用的任务查询接口。

这是当前最推荐的任务查询接口。

GET /v1/tasks/{task_id}

接口概览

说明
路由GET /v1/tasks/{task_id}
鉴权Authorization: Bearer sk_yeehoo_xxx
路径参数task_id
返回200 OK + 任务对象

为什么推荐优先用它

  • 图片和视频都能统一查询
  • 业务层更容易做统一状态机
  • 更适合轮询和 webhook 结合

Authorizations

Authorization: Bearer sk_yeehoo_your_api_key

Path Parameters

参数类型必填说明
task_idstring创建任务后返回的任务 ID

Response

成功时通常返回任务详情对象。

{
  "task_id": "task_01jxyz...",
  "object": "task",
  "kind": "image",
  "model": "gpt-image-2",
  "status": "succeeded",
  "progress": 100,
  "created_at": 1784779200,
  "completed_at": 1784779260,
  "result": {}
}

响应字段说明

字段类型说明
task_idstring任务 ID
kindstring任务类型,如 imagevideo
modelstring实际执行模型
statusstring当前状态,如 queuedrunningsucceededfailed
progressinteger任务进度
created_atinteger创建时间戳
completed_atinteger完成时间戳
resultobject成功时的结果对象
errorobject失败时的错误对象

接入建议

  • 如果已经收到了 webhook,关键链路里仍建议再查一次任务终态
  • 轮询频率不要过高,建议做退避或固定间隔
  • 把任务查询结果作为最终状态源会更稳