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

# MiniMax-H3-Lite 视频生成

> 支持文生视频、首帧或首尾帧图生视频、多模态参考生视频。输出支持 480P 和 768P，时长为 4 到 15 秒。

```bash cURL theme={null}
curl --request POST \
  --url https://api.apimart.ai/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "MiniMax-H3-Lite",
    "prompt": "镜头穿过夜晚的霓虹街道，雨滴落在车窗上。",
    "resolution": "768P",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'
```

```json 200 theme={null}
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
    }
  ]
}
```

```json 400 theme={null}
{
  "error": {
    "code": 400,
    "message": "MiniMax-H3-Lite only supports resolution = 480P or 768P",
    "type": "invalid_request_error"
  }
}
```

**Authorization** `string` *required*

请求头使用 `Bearer <token>`，将 `<token>` 替换为你的 API 密钥。

**model** `string` *required*

模型 ID 使用 `MiniMax-H3-Lite`。

**prompt** `string` *required*

非空的视频提示词，最多 7000 个字符。

**duration** `integer` (default: 5)

输出时长，取值为 4 到 15 的整数，单位为秒。

**resolution** `string` (default: 768P)

支持 `480P` 和 `768P`，大小写均可，也接受字符串 `480` 和 `768`。

**aspect\_ratio** `string`

输出宽高比。也可以通过 `size` 或 `ratio` 传递。

* 文生视频和多模态参考生视频可选 `21:9`、`16:9`、`4:3`、`1:1`、`3:4`、`9:16`，默认 `16:9`。传 `adaptive` 或 `auto` 会返回 HTTP 400。
* 首帧或首尾帧图生视频按输入帧图比例输出。可省略该字段或传 `adaptive`。传其他合法比例时仍使用输入帧图比例。

**first\_frame\_image** `string`

首帧图片的公网 HTTP(S) URL。也接受 Data URI，由平台转存。

**last\_frame\_image** `string`

尾帧图片的公网 HTTP(S) URL。使用尾帧时必须同时提供首帧。

**image\_with\_roles** `object[]`

为图片明确指定首帧、尾帧或参考图角色。首帧和尾帧各最多一张。

**image\_with\_roles**

**url** `string` *required*

图片的公网 HTTP(S) URL。

**role** `string`

`first_frame` / `last_frame` / `reference_image`

**image\_urls** `string[]`

参考图的公网 HTTP(S) URL 数组，与 `image_with_roles` 中的参考图合计最多 9 张。每张图均按参考图处理。需要控制首帧或尾帧时请使用相应帧字段或角色。

**video\_urls** `string[]`

参考视频的公网 HTTP(S) URL 数组。最多 3 段，每段 2 到 15 秒，合计不超过 15 秒。单段视频也可使用字符串字段 `video_url`。

**audio\_urls** `string[]`

参考音频的公网 HTTP(S) URL 数组。最多 3 段，每段 2 到 15 秒，合计不超过 15 秒。至少搭配一张参考图或一段参考视频。单段音频也可使用字符串字段 `audio_url`。

**watermark** `boolean` (default: false)

是否添加 AIGC 水印。也可以通过 `metadata.aigc_watermark` 传递。

**webhook** `string`

任务成功或失败时接收通知的回调地址。

## 输入素材要求

素材 URL 必须能从公网直接访问。尺寸范围适用于宽和高，比例按宽除以高计算。

| 素材 | 格式与编码 | 单文件大小 | 尺寸、宽高比和帧率 |
| - | - | - | - |
| 图片 | JPG / JPEG / PNG / WEBP / HEIC / HEIF | ≤ 30 MB | 256–5760 px, 0.4–2.5 |
| 参考视频 | MP4 / MOV (H.264 / H.265, AAC / MP3) | ≤ 50 MB | 256–5760 px, 0.4–2.5, 23.976–60 fps |
| 参考音频 | WAV / MP3 | ≤ 15 MB | — |

## 请求示例

### 首帧图生视频

```json theme={null}
{
  "model": "MiniMax-H3-Lite",
  "prompt": "镜头缓缓推进，晨光逐渐照亮房间。",
  "first_frame_image": "https://example.com/first.png",
  "resolution": "480P",
  "duration": 4
}
```

### 首尾帧图生视频

```json theme={null}
{
  "model": "MiniMax-H3-Lite",
  "prompt": "镜头从清晨自然过渡到夜晚，屋内灯光亮起。",
  "image_with_roles": [
    {
      "url": "https://example.com/first.png",
      "role": "first_frame"
    },
    {
      "url": "https://example.com/last.png",
      "role": "last_frame"
    }
  ],
  "resolution": "768P",
  "duration": 5
}
```

### 多模态参考生视频

```json theme={null}
{
  "model": "MiniMax-H3-Lite",
  "prompt": "以参考图为角色形象，复现参考视频的动作，并用参考音色说出对白。",
  "image_urls": [
    "https://example.com/character.png"
  ],
  "video_urls": [
    "https://example.com/motion.mp4"
  ],
  "audio_urls": [
    "https://example.com/voice.mp3"
  ],
  "resolution": "768P",
  "duration": 5,
  "aspect_ratio": "16:9"
}
```

## 查询任务

提交成功后，从 `data[0].task_id` 获取任务 ID。通过[查询任务状态](https://docs.apimart.ai/cn/api-reference/tasks/status.md)每 5 到 10 秒轮询一次，客户端超时建议设为 15 分钟。

```bash theme={null}
curl https://api.apimart.ai/v1/tasks/task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ \
  --header 'Authorization: Bearer <token>'
```

`data.status` 为 `completed` 时，从 `data.result.videos[0].url` 数组获取视频地址。状态为 `failed` 时，查看 `data.error.message`。

实际扣费金额见 `data.cost`。

## 计费

费用按所选分辨率及输入素材计算。账户适用单价见[模型价格查询接口](https://api.apimart.ai/api/pricing/model?model=MiniMax-H3-Lite)。

* 输出视频与参考视频使用同一档每秒单价。例如生成 5 秒视频并传入共 6 秒的参考视频，按 11 秒计费。
* 首帧、尾帧和参考图合计前 5 张免费，第 6 张起按张收费。
* 参考音频免费。

提交任务时预扣费用，生成失败后自动全额退回。

## 常见参数错误

以下情况会在提交时返回 HTTP 400，无需轮询，也不会扣费。

* 分辨率或时长超出范围。使用 `480P` 或 `768P`，并将 `duration` 设为 4 到 15 的整数。
* 只传尾帧、混用帧图和参考素材，或只传参考音频。尾帧需搭配首帧，参考音频需搭配参考图或参考视频。
* 参考素材数量或参考视频时长超限。检查各素材上限并裁剪参考视频。
* 参考视频时长无法读取。检查 URL 是否可公网直连、视频文件是否有效。

若收到 `model_not_found`，检查模型 ID 是否精确写成 `MiniMax-H3-Lite`。


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