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

# 视频任务流程

> 创建、查询和下载 AGICTO API 视频任务

视频生成通常是异步任务。你需要先创建任务，再轮询任务状态，最后下载或读取结果。

## 选择接口格式

AGICTO API 提供两类视频接口：

| 类型          | 适合场景                     | 文档入口                                                           |
| ----------- | ------------------------ | -------------------------------------------------------------- |
| OpenAI 兼容格式 | 你希望统一使用 `/v1/videos` 工作流 | <a href="/api-reference/openai-video/sora/create">创建视频</a>     |
| 官方视频格式      | 你要使用豆包、万相、海螺、可灵等供应商参数    | <a href="/api-reference/official-video/doubao/create">豆包视频</a> |

## OpenAI 兼容格式流程

<Steps>
  <Step title="创建任务">
    调用 `POST /v1/videos`。请求使用 `multipart/form-data`。
  </Step>

  <Step title="保存任务 ID">
    响应中会返回 `id`。后续查询和下载都需要使用这个值。
  </Step>

  <Step title="查询状态">
    调用 `GET /v1/videos/{id}`，直到任务进入完成状态。
  </Step>

  <Step title="下载结果">
    调用 `GET /v1/videos/{id}/content` 获取视频内容。
  </Step>
</Steps>

## 创建视频

```bash theme={null}
curl https://api.agicto.cn/v1/videos \
  -H "Authorization: Bearer $API_KEY" \
  -F "model=sora-2-vip" \
  -F "prompt=一辆电动汽车驶过未来城市街道，雨夜霓虹，电影感" \
  -F "seconds=8" \
  -F "size=1280x720"
```

## 查询视频

```bash theme={null}
curl https://api.agicto.cn/v1/videos/video_fe6f922f-da34-48a4-9c35-e71df5950cbf \
  -H "Authorization: Bearer $API_KEY"
```

## 下载视频

```bash theme={null}
curl https://api.agicto.cn/v1/videos/video_fe6f922f-da34-48a4-9c35-e71df5950cbf/content \
  -H "Authorization: Bearer $API_KEY" \
  --output result.mp4
```

## 官方视频格式

如果你需要供应商专有参数，使用官方视频格式接口：

<CardGroup cols={2}>
  <Card title="豆包视频" icon="video" href="/api-reference/official-video/doubao/create">
    创建豆包视频任务并查询结果。
  </Card>

  <Card title="万相视频" icon="video" href="/api-reference/official-video/wanxing/create">
    创建万相视频任务并查询结果。
  </Card>

  <Card title="海螺视频" icon="video" href="/api-reference/official-video/hailuo/create">
    创建海螺视频任务并查询结果。
  </Card>

  <Card title="可灵视频" icon="video" href="/api-reference/official-video/kling/text-to-video-create">
    使用可灵文生视频、图生视频和视频生音效接口。
  </Card>
</CardGroup>
