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

# MAGI-2 视频 API

> 通过 /v1/videos 调用 MAGI-2，支持文生视频与参考生视频。

# MAGI-2 视频 API

通过 OpenAI 兼容视频接口创建、查询并下载视频任务，支持文生视频与参考生视频。

| 说明 | 方法 | 路径 |
| - | - | - |
| 创建视频任务 | `POST` | `/v1/videos` |
| 获取视频任务 | `GET` | `/v1/videos/{task_id}` |
| 下载视频成品 | `GET` | `/v1/videos/{task_id}/content` |

**API 主机：** `https://api.omniall.ai` · 鉴权 `Authorization: Bearer sk-...`。

**模型：** `magi-2`（以[模型广场](https://omniall.ai/pricing)为准）。

## 请求体字段

| 字段 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | | 模型名称，使用 `magi-2` |
| `prompt` | string | 是 | 文本提示词，支持中英文 |
| `mode` | string | | `i2v` / `r2v` / `t2v`；不传则自动推断 |
| `resolution` | string | | 可选值：`1080p`；无法识别时默认 `1080p` |
| `aspect_ratio` | string | | `21:9` / `16:9` / `4:3` / `1:1` / `3:4` / `9:16`；默认 `16:9`；也可由 `size` 推断 |
| `duration` | integer | | 也支持字段名 `seconds`；范围 **4–30** 秒；默认 **5** |
| `seconds` | string / integer | | `duration` 别名；建议传字符串如 `"5"` |
| `audio` | boolean | | 输出是否包含音轨；默认 `true` |
| `reference_images` | array | | 参考图，最多 **10** |
| `reference_videos` | array | | 参考视频，最多 **5** 段，总时长不超过 **15** 秒 |
| `reference_audios` | array | | 参考音频，最多 **5** 段 |

素材字段既可直接传入公开可访问的 URL，也可随创建请求以 `multipart/form-data` 上传文件。

## 任务状态

| 状态 | 说明 |
| - | - |
| `queued` | 任务已受理，等待生成 |
| `in_progress` | 正在生成视频 |
| `completed` | 视频已生成完成，可通过结果地址下载 |
| `failed` | 生成失败或任务被终止，失败原因见 `error` 字段 |

## 示例

```bash theme={null}
curl --request POST \
  --url 'https://api.omniall.ai/v1/videos' \
  --header 'Authorization: Bearer sk-...' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "magi-2",
  "prompt": "以参考图为场景，镜头缓缓向前推进",
  "duration": 5,
  "resolution": "1080p",
  "aspect_ratio": "16:9",
  "audio": true
}'
```

完整接口说明见 **API 参考 → 视频 → MAGI-2**。


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