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

# mini-2.0 视频生成

> 使用 JSON 请求调用 mini-2.0 提交视频生成任务。

# mini-2.0 视频生成

`mini-2.0` 使用 `application/json` 请求体提交异步视频任务。可以只传文字生成视频，也可以通过 `images` 传入参考图生成视频。

## 模型规格

| 项目      | 说明                                        |
| ------- | ----------------------------------------- |
| `model` | 固定传 `mini-2.0`                            |
| 请求格式    | `application/json`                        |
| 时长      | `duration` 支持 `4` 到 `15` 秒的整数             |
| 画幅      | `ratio` 仅支持 `16:9`、`9:16`                 |
| 清晰度     | `resolution` 固定为 `480p`，服务端会统一按 `480p` 处理 |
| 参考图     | `images` 可选，最多 `9` 张公网图片 URL              |

## 方法与路径

```http theme={null}
POST /v1/videos
```

## 请求示例

<RequestExample>
  ```bash 文生视频 cURL theme={null}
  curl -X POST https://magic666.top/v1/videos \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "mini-2.0",
      "prompt": "清晨海边，航拍镜头掠过浪花，阳光穿过薄雾，电影感",
      "duration": 8,
      "ratio": "16:9",
      "resolution": "480p"
    }'
  ```

  ```bash 参考图生视频 cURL theme={null}
  curl -X POST https://magic666.top/v1/videos \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "mini-2.0",
      "prompt": "参考人物外观和服装，让人物自然转身并走向镜头，保持竖屏构图",
      "duration": 6,
      "ratio": "9:16",
      "resolution": "480p",
      "images": [
        "https://example.com/assets/character.png",
        "https://example.com/assets/background.png"
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  resp = requests.post(
      "https://magic666.top/v1/videos",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
      },
      json={
          "model": "mini-2.0",
          "prompt": "参考产品图生成一段镜头缓慢环绕产品的广告视频",
          "duration": 8,
          "ratio": "16:9",
          "resolution": "480p",
          "images": ["https://example.com/assets/product.png"],
      },
      timeout=120,
  )

  print(resp.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://magic666.top/v1/videos", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "mini-2.0",
      prompt: "清晨森林中的小路，镜头平稳向前推进",
      duration: 8,
      ratio: "16:9",
      resolution: "480p",
    }),
  });

  console.log(await response.json());
  ```
</RequestExample>

## 响应示例

<ResponseExample>
  ```json 200 - 提交成功 theme={null}
  {
    "id": "mini-2.0_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "task_id": "mini-2.0_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "object": "video",
    "model": "mini-2.0",
    "status": "queued",
    "progress": 0,
    "created_at": 1782690295,
    "completed_at": null,
    "duration": 8,
    "url": null,
    "video_url": null,
    "metadata": {},
    "error": null
  }
  ```

  ```json 400 - 参数错误 theme={null}
  {
    "error": {
      "message": "ratio must be 16:9 or 9:16",
      "type": "invalid_request_error",
      "param": "ratio",
      "code": "invalid_request_error"
    }
  }
  ```
</ResponseExample>

## 认证

```http theme={null}
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## Body

<ParamField body="model" type="string" required>
  模型名称。固定传 `mini-2.0`。
</ParamField>

<ParamField body="prompt" type="string" required>
  视频生成提示词。参考图模式下，说明图片中的主体、动作和镜头关系。
</ParamField>

<ParamField body="duration" type="integer" required>
  输出视频时长，单位为秒。支持 `4` 到 `15` 秒的整数。
</ParamField>

<ParamField body="ratio" type="string" required>
  画幅比例。仅支持 `16:9` 和 `9:16`。
</ParamField>

<ParamField body="resolution" type="string" required>
  输出清晰度。传 `480p`；该模型不提供其它清晰度档位。
</ParamField>

<ParamField body="images" type="array<string>">
  可选参考图数组。最多 9 张，每项使用公网图片 URL；本地图片需要先上传。
</ParamField>

## 注意事项

* JSON 请求必须携带 `Content-Type: application/json`。
* `duration` 只能传 `4` 到 `15` 的整数。
* `ratio` 只能传 `16:9` 或 `9:16`。
* 服务端将 `resolution` 统一按 `480p` 处理。
* `images` 不是 `content` 数组，最多传 9 张，不能使用 data URI。

## 相关接口

* [mini-2.0 视频概览](./overview)
* [mini-2.0 查询视频任务](./query)
* [视频模型支持矩阵](/api-reference/videos/model-matrix)
