# 轮询视频生成任务

**API:** Model API

**Endpoint:** `GET /api/v1/videos/generations/{task_id}`

返回当前任务状态。当 status 为 succeeded 时，outputs 中包含可匿名下载的带签名媒体 URL（https://openapi.felo.ai/api/v1/media/{file_id}?exp=...&sig=...）。请每隔 5-10 秒轮询一次；任务本身会在后台继续执行。

## Base URL

- `https://openapi.felo.ai` — 生产环境

## Authentication

- `FeloBearerAuth` (http bearer) — 以 `Authorization: Bearer <key>` 形式发送的 Felo API 密钥。
- `FeloApiKey` (apiKey in header `X-API-Key`) — 以 `X-API-Key: <key>` 形式发送的 Felo API 密钥。

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `task_id` | path | yes | string | POST /api/v1/videos/generations 返回的任务 ID。 |

## Responses

### 200 — 当前任务状态

**application/json**

Schema: `VideoGenerationTask` (`#/components/schemas/VideoGenerationTask`)

### 401 — Felo API 密钥无效或缺失

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 404 — 未找到该账户下的任务

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 503 — 生成服务暂时不可用

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

## Schema definitions

### GenerationError

`#/components/schemas/GenerationError`

```json
{
  "type": "object",
  "description": "兼容 OpenAI 的错误封装。",
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message",
        "type"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "invalid_request_error",
            "server_error"
          ]
        },
        "param": {
          "type": "string",
          "nullable": true
        },
        "code": {
          "type": "string"
        }
      }
    }
  }
}
```

### VideoGenerationTask

`#/components/schemas/VideoGenerationTask`

```json
{
  "type": "object",
  "required": [
    "task_id",
    "status",
    "kind",
    "outputs"
  ],
  "properties": {
    "task_id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "interrupted"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "video"
      ]
    },
    "outputs": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri",
        "description": "任务成功后为带签名的媒体 URL（可匿名下载）；否则为 []。"
      }
    },
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "code": {
          "type": "string",
          "description": "Stable failure code, e.g. file_not_found."
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "description": "任务失败时出现。"
    }
  }
}
```
