章鱼哥AI接口文档

MiniMax

支持首尾帧生成,以及图片、视频和音频组合参考。

本系列支持的端点
  • MiniMax创建POST https://zexapi.com/v1/videos
POSThttps://zexapi.com/v1/videos
鉴权 Authorization: Bearer YOUR_API_KEY

使用 API Key 进行 Bearer 鉴权。JSON 请求设置 Content-Type: application/json;Multipart 请求由客户端自动生成 boundary。

首帧和首尾帧模式只用 images,不要同时传 videos 或 audios。
  • 素材 URL 必须是无需登录、直接返回文件内容的地址。

MiniMax 视频生成接口文档

接口地址

POST /v1/videos

功能说明

支持 MiniMax H3 系列模型的文生视频、首帧/首尾帧视频,以及图片、视频、音频参考内容驱动的视频生成。

当前模型

模型名支持模式时长说明
minimax-h3文生视频、首帧/首尾帧、参考内容生成4~15 秒MiniMax H3 标准模型
minimax-h3-max文生视频、首帧/首尾帧、参考内容生成4~15 秒MiniMax H3 Max 模型
两款模型都通过 seconds 指定 4~15 秒的输出时长,并且都支持首帧和首尾帧。调用时必须使用表格中的完整模型名。
首帧模式只传 1 张图片并设置 first_last_frame: true。首尾帧模式依次传首帧、尾帧,并设置 first_last_frame: true。

模式判定

模式传参方式
文生视频不传 images、videos、audios,或全部传空数组
首帧images 传 1 张图片,并传 first_last_frame: true
首尾帧images 依次传首帧、尾帧,并传 first_last_frame: true
参考内容生成传入参考素材,且不传 first_last_frame 或传 false
first_last_frame 只决定图片是首/尾帧还是普通参考图:
true:首帧或首尾帧模式;第 1 张图是首帧,第 2 张图是尾帧。只传 1 张时表示仅指定首帧。
false 或不传:参考模式;图片、视频、音频按传入顺序作为参考内容。
参考模式下,应在 prompt 中说明每项素材的作用和编号。首帧/首尾帧只使用 images,不要同时传 videos 或 audios。

请求方式

方式Content-Type参考素材字段
JSONapplication/jsonimages、videos、audios
表单multipart/form-data只使用可重复的 input_reference
表单没有 video_reference 或 audio_reference 字段。无论文件类型,均重复使用 input_reference。

请求头

参数名类型必填说明
Authorizationstring是Bearer YOUR_API_KEY
Content-Typestring是application/json 或 multipart/form-data

JSON 请求体说明

参数名类型必填说明
modelstring是minimax-h3 或 minimax-h3-max
promptstring是视频生成提示词
imagesstring[]否图片 URL 或完整 Base64 data URI
videosstring[]否可公网访问的视频文件直链
audiosstring[]否可公网访问的音频文件直链
aspect_ratiostring否支持 16:9、9:16、1:1、4:3、3:4、21:9
resolutionstring否输出分辨率,只支持 480p、768p。不传时使用模型默认值
secondsstring是输出时长,字符串形式,支持 "4"~"15"
first_last_frameboolean否true 表示首帧/首尾帧模式;不传或 false 表示参考模式

参考素材 JSON 结构

{
  "images": [
    "https://example.com/ref.png"
  ],
  "videos": [
    "https://example.com/ref.mp4"
  ],
  "audios": [
    "https://example.com/ref.mp3"
  ]
}
数组元素必须直接填写实际 URL。例如应填写 "https://example.com/ref.png",不要填写 Markdown 形式的 [https://...](https://...)。

素材数量约定

首帧/首尾帧:images 传 1~2 张图片。第 1 张是首帧,第 2 张是尾帧;只有 1 张时表示仅指定首帧。
参考内容:图片、视频、音频合计最多 5 项。
多项素材按各自数组中的顺序编号为图片 1、图片 2、视频 1、音频 1 等。
文件数量越多、单个文件越大,上传和生成耗时越长。

表单字段说明

参数名类型必填说明
modelstring是minimax-h3 或 minimax-h3-max
promptstring是视频生成提示词
input_reference可重复字段否图片、视频、音频文件或 URL;每项重复传一次
aspect_ratiostring否视频宽高比
resolutionstring否输出分辨率,只支持 480p、768p。不传时使用模型默认值
secondsstring是输出时长,支持 4~15
first_last_frameboolean/string否true 为首帧/首尾帧模式;不传或 false 为参考模式

input_reference 的传法

方式示例
本地图片-F "input_reference=@/path/to/ref.png"
本地视频-F "input_reference=@/path/to/ref.mp4"
本地音频-F "input_reference=@/path/to/ref.mp3"
公网直链-F "input_reference=https://example.com/ref.png"

请求示例

文生视频(JSON)

curl -X POST "https://xxxxx.com/v1/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3-max",
    "prompt": "未来城市的夜晚,无人驾驶跑车穿过雨后的霓虹街道,电影质感",
    "aspect_ratio": "16:9",
    "resolution": "768p",
    "seconds": "10"
  }'

首尾帧视频(JSON)

curl -X POST "https://xxxxx.com/v1/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3-max",
    "prompt": "从首帧自然过渡到尾帧,保持人物和产品外观一致",
    "images": [
      "https://example.com/first.webp",
      "https://example.com/last.webp"
    ],
    "aspect_ratio": "16:9",
    "resolution": "768p",
    "seconds": "10",
    "first_last_frame": true
  }'

多图参考(JSON)

curl -X POST "https://xxxxx.com/v1/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3",
    "prompt": "图片 1 是产品,图片 2 是人物,图片 3 是场景;保持主体一致,制作商业广告",
    "images": [
      "https://example.com/product.png",
      "https://example.com/person.png",
      "https://example.com/scene.png"
    ],
    "aspect_ratio": "9:16",
    "resolution": "768p",
    "seconds": "10",
    "first_last_frame": false
  }'

图片、视频和音频组合参考(JSON)

curl -X POST "https://xxxxx.com/v1/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3",
    "prompt": "图片 1 提供产品外观,视频 1 提供镜头运动,音频 1 控制剪辑节奏",
    "images": [
      "https://example.com/ref.png"
    ],
    "videos": [
      "https://example.com/ref.mp4"
    ],
    "audios": [
      "https://example.com/ref.mp3"
    ],
    "aspect_ratio": "16:9",
    "resolution": "768p",
    "seconds": "12"
  }'

本地组合参考文件(表单,仅使用 input_reference)

curl -X POST "https://xxxxx.com/v1/videos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "model=minimax-h3" \
  -F "prompt=图片作为主体参考,视频作为运镜参考,音频作为节奏参考" \
  -F "input_reference=@/path/to/ref.png" \
  -F "input_reference=@/path/to/ref.mp4" \
  -F "input_reference=@/path/to/ref.mp3" \
  -F "aspect_ratio=16:9" \
  -F "resolution=480p" \
  -F "seconds=12"

响应参数

任务处理中

{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "minimax-h3",
  "status": "in_progress",
  "progress": 10,
  "created_at": 1791320000
}
完成态视频地址位于顶层 url 和 video_url,两者值相同。
参数名类型说明
idstring任务 ID
objectstring固定值 video
modelstring实际使用的模型名称
statusstringqueued、in_progress、completed、failed
progressnumber任务进度,0~100
created_atnumber创建时间戳(秒)
completed_atnumber完成时间戳(秒,仅完成态)
urlstring视频直链(仅完成态)
video_urlstring与 url 同值(仅完成态)
errorobject失败信息,通常包含 code、message

提交成功

{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "minimax-h3",
  "status": "queued",
  "progress": 0,
  "created_at": 1791320000
}

任务完成

{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "minimax-h3",
  "status": "completed",
  "progress": 100,
  "created_at": 1791320000,
  "completed_at": 1791320060,
  "url": "https://example.com/output.mp4",
  "video_url": "https://example.com/output.mp4"
}

任务失败

{
  "id": "task_xxxxxxxxxxxxx",
  "object": "video",
  "model": "minimax-h3",
  "status": "failed",
  "progress": 0,
  "created_at": 1791320000,
  "error": {
    "code": "invalid_request",
    "message": "请求参数不符合模型能力限制"
  }
}

查询任务状态

GET /v1/videos/{task_id}
curl -X GET "https://xxxxx.com/v1/videos/task_xxxxxxxxxxxxx" \
  -H "Authorization: Bearer YOUR_API_KEY"
queued / in_progress 时继续轮询;completed 时读取顶层 url 或 video_url;failed 时读取 error.message。

注意事项

1.
minimax-h3 和 minimax-h3-max 的 seconds 都必须使用字符串,支持 "4"~"15"。
2.
两款模型都支持首帧和首尾帧。首尾帧模式最多传 2 张图片:images[0] 是首帧,images[1] 是尾帧;只有 1 张时表示仅指定首帧。
3.
首帧/首尾帧必须显式传 first_last_frame: true;不传或传 false 会按普通参考模式处理。首帧/首尾帧不要同时传 videos 或 audios。
4.
文生视频不传参考素材。参考模式传入图片、视频或音频,且不传 first_last_frame 或传 false。
5.
JSON 分别用 images、videos、audios;表单只有可重复的 input_reference。表单开启首尾帧时额外传 first_last_frame=true。
6.
JSON 数组元素只填写实际文件直链或受支持的 data URI,不要填写 Markdown 链接语法。
7.
参考内容的图片、视频、音频合计最多 5 项;建议在 prompt 中明确每项素材的编号和用途。
8.
URL 必须是无需登录、可直接返回文件内容的公网直链。
9.
resolution 只支持 480p、768p。不传时使用模型默认值。
10.
接口为异步接口,提交成功后需轮询任务状态。

接口地址

POST /v1/videos

视频调试参数说明

先选择生成方式,再选择型号。参考图片与首尾帧为独立用法,切换用法后显示对应素材输入。JSON 使用 images 数组;表单使用重复的 input_reference 文件字段。

请求示例:文生视频(表单上传)

curl --request POST 'https://zexapi.com/v1/videos' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --form-string 'model=minimax-h3' \
  --form-string 'prompt=生成自然连贯的视频' \
  --form-string 'seconds=10'

请求示例:首帧 / 首尾帧(表单上传)

curl --request POST 'https://zexapi.com/v1/videos' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --form-string 'model=minimax-h3' \
  --form-string 'prompt=生成自然连贯的视频' \
  --form-string 'seconds=10' \
  --form-string 'first_last_frame=true' \
  --form 'input_reference=@/path/to/reference.png'