> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiohub.org/llms.txt
> Use this file to discover all available pages before exploring further.

# 查询视频 · OpenAI 视频

> 查询任务状态、判断成功或失败，并获取视频下载地址。

## 查询与状态判断

将 `<TASK_ID>` 替换为返回的 `id`，每 10 到 15 秒查询一次：

```bash theme={"system"}
curl "https://api.aiohub.org/v1/videos/<TASK_ID>" \
  -H "Authorization: Bearer <AIOHUB_API_KEY>"
```

| `status` | 处理 |
| - | - |
| `queued` / `in_progress` | 继续查询 |
| `completed` | 下载 MP4 |
| `failed` | 停止查询，读取 `error.message` |

任务成功后，按 [下载视频](/cn/api/video-content) 保存文件。

## 失败与重试

HTTP 200 下的 `failed` 仍表示生成失败。查询断线后继续用原 `id` 查询；400 参数错误需要先修正请求。文件保留 72 小时，任务记录保留 7 天。

收到 429 或临时不可用错误时，等待后重试查询，不要重新创建任务。查询不到任务时，确认任务标识和 API 令牌所属账号。


## OpenAPI

````yaml openapi/relay.json GET /v1/videos/{task_id}
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub 公开 API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: 获取模型列表
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: 图片生成
  - name: OpenAI 图像
  - name: 视频生成
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: 文本补全
  - name: OpenAI 音频
  - name: Realtime API
paths:
  /v1/videos/{task_id}:
    get:
      tags:
        - 视频生成
      summary: 获取视频任务状态
      description: >
        OpenAI 兼容的视频任务状态查询接口。


        返回视频任务的详细状态信息。



        Seedance 任务的 `status` 为 `queued`、`in_progress`、`completed` 或 `failed`。仅在
        `completed` 后下载；`failed` 时读取 `error.message`。
      operationId: getVideo
      parameters:
        - name: task_id
          in: path
          description: 视频任务 ID
          required: true
          example: video-123456
          schema:
            type: string
      responses:
        '200':
          description: 成功获取视频任务状态
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  model:
                    type: string
                  status:
                    type: string
                  progress:
                    type: integer
                  created_at:
                    type: integer
                  seconds:
                    type: string
                  error:
                    $ref: '#/components/schemas/OpenAIVideoError'
                required:
                  - id
                  - object
                  - model
                  - status
                  - progress
                  - created_at
                  - seconds
              example:
                id: task_example
                object: video
                model: doubao-seedance-2-5-260628
                status: completed
                progress: 100
                created_at: 1791275108
                seconds: '4'
          headers: {}
        '404':
          description: 任务不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    OpenAIVideoError:
      type: object
      description: OpenAI 视频错误信息
      properties:
        message:
          type: string
          description: 错误信息
        code:
          type: string
          description: 错误码
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: 错误信息
            type:
              type: string
              description: 错误类型
            param:
              type: string
              description: 相关参数
              nullable: true
            code:
              type: string
              description: 错误代码
              nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.