OpenAI 格式

Grok 任务查询

使用 `GET /v1/videos/{task_id}` 查询 Grok 视频任务进度、结果与错误信息。

GEThttps://duoyuanx.com/v1/videos/{task_id}
请求示例
curl https://duoyuanx.com/v1/videos/video_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"
响应示例
{
  "id": "video_abc123",
  "object": "video",
  "model": "grok-imagine-video-1.5",
  "status": "processing",
  "progress": 42,
  "created_at": 1735689600,
  "completed_at": 0,
  "expires_at": 1735776000,
  "seconds": "6",
  "size": "720P",
  "remixed_from_video_id": "",
  "error": {
    "message": "",
    "code": ""
  },
  "video_url": ""
}

使用 POST /v1/videos 提交 Grok Imagine Video 任务后,通过 GET /v1/videos/{task_id} 轮询状态。

  • 接口路径是 GET /v1/videos/{task_id}。
  • 任务完成后通常可从 video_url 或 output.url 读取结果地址。
  • 如果直接下载 video_url 失败,可回退到 GET /v1/videos/{task_id}/content。

请求头

Authorizationstring必填

请求身份认证。使用 Bearer Token,示例值:Bearer YOUR_API_KEY。

请求参数

task_idstring必填

视频任务 ID。

请求示例

响应示例

响应字段

idstring

任务 ID。

statusstring

任务状态。常见值有 processing、failed、completed。

progressinteger

进度百分比。

completed_atinteger

完成时间戳。

expires_atinteger

结果过期时间戳。

secondsstring

输出时长。创建任务时使用 duration 指定时长。

sizestring

输出清晰度档位。

video_urlstring

视频地址。完成时会优先尝试读取这个字段,或兼容读取 output.url。

errorobject

失败原因对象。

轮询建议

实现会按以下顺序取结果地址:

  1. output.url
  2. video_url
  3. url
  4. detail.url

如果直接下载返回的视频地址失败,再回退请求:

GET /v1/videos/{task_id}/content

相关接口