MiniMax H3 Image API
MiniMax H3 图像模型 API,两档:minimax-h3-image(标准)和 minimax-h3-image-highspeed(高速)。同一个接口做文生图和改图:只传提示词,或再加 1–16 张参考图;一次 1–10 张,1K / 2K / 4K(缺省 2K),1:3 到 3:1 任意比例,或 655,360–20,000,000 像素的精确尺寸。两档请求写法完全一样,只差速度和价格。
认证
所有请求在 Header 携带 API Key:
Authorization: Bearer YOUR_API_KEY价格
| 项目 | minimax-h3-image | minimax-h3-image-highspeed |
|---|---|---|
| 每张输出 · 1K / 2K | $0.03 | $0.05 |
| 每张输出 · 4K | $0.10 | $0.18 |
| 每张参考图 | +$0.01 | +$0.015 |
精确尺寸 size 按面积分档:不超过 5,033,165 像素按 1K / 2K 价,超过按 4K 价。文字提示不收钱。建单时按 n 张和全部参考图冻结额度,完成后只按实际出成的张数结算,多冻的退回;整单失败不扣费。
文生图
/v1/images/generations缺省异步:创建返回 taskId,轮询 GET ?task_id= 到 completed,从 resultUrls 取图(n 张就有 n 个链接),或用 callback_url 接 webhook。我们实测 1K 16:9 文生图约 10 秒,实得 1360×768;高速版一张 1K 海报约 6 秒。4K、一次多张会更久。
# Text-to-image — create returns a taskId, then poll for the result.
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3-image",
"prompt": "A cozy cafe counter at golden hour, a ceramic latte cup with leaf latte art and rising steam, a croissant on a small plate, warm window light, shallow depth of field, film grain",
"resolution": "1K",
"aspect_ratio": "16:9",
"n": 2
}'
# → { "code": 200, "data": { "taskId": "...", "state": "pending", "model": "minimax-h3-image" } }
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# → { "code": 200, "data": { "state": "completed", "resultUrls": ["https://r2.apimodels.app/...", "https://r2.apimodels.app/..."] } }改图 · 多图合成
带 image(单张)或 images(最多 16 张)就是改图 / 多图合成,提示词里用「图1」「图2」指代(英文提示词写 image 1、image 2)。参考图可以是公网网址或 data URI;超过约 240 万像素的会先等比缩小再发出。我们实测带一张 1K 参考图的改图约 16 秒。
# Edit / combine — 1 to 16 reference images (+$0.01 each, +$0.015 on Highspeed).
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3-image",
"prompt": "Replace the croissant on the plate with a slice of strawberry cheesecake. Keep the cup, saucer, latte art, steam, table, window light and everything else exactly the same.",
"image": "https://example.com/cafe.jpg",
"resolution": "1K",
"aspect_ratio": "16:9"
}'
# Several references — refer to them as image 1, image 2 in the prompt.
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3-image",
"prompt": "put the vase from image 2 on the table in image 1; keep the room, furniture and lighting unchanged",
"images": ["https://example.com/dining-room.jpg", "https://example.com/vase.png"]
}'一次调用直接拿图(OpenAI 风格)
传「宽x高」形式的 size 且不带 callback_url,请求会一直等到出图,响应直接是 { created, data: [{ b64_json, url, width, height }], size };加 "response_format": "url" 可以不要 base64。OpenAI SDK 的 images.generate 拿到的就是这种响应。超时请设得宽一些:4K 或一次多张可能要一分钟以上。
# One call: an exact WIDTHxHEIGHT size and no callback_url — the images come back in this response.
curl -X POST https://api.apimodels.app/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-h3-image-highspeed",
"prompt": "A minimalist jazz night poster: a deep blue background, a gold trumpet silhouette, the headline \"BLUE NOTE FRIDAY\" in large elegant serif letters, and a smaller line \"Live at The Lantern Room - 9 PM\" at the bottom",
"size": "2720x1536",
"response_format": "url"
}'
# → { "created": ..., "data": [{ "url": "https://r2.apimodels.app/...", "width": 2720, "height": 1536 }], "size": "2720x1536" }参数
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
| model | 是 | string | minimax-h3-image 或 minimax-h3-image-highspeed(MiniMax 的写法 MiniMax-H3-Image / MiniMax-H3-Image-Highspeed 也认) |
| prompt | 是 | string | 必填,最多 32,000 个字符;参考图按「图1、图2」指代 |
| n | 否 | integer | 1–10,默认 1;只对出成的张收费 |
| resolution | 否 | string | 1K / 2K / 4K(默认 2K);也认 area |
| aspect_ratio | 否 | string | auto(默认,由模型按提示词决定)或 1:3 到 3:1 之间的 X:Y,如 16:9、4:5、21:9 |
| size | 否 | string | 精确尺寸,如 2720x1536;面积 655,360–20,000,000 像素、比例 1:3–3:1。给了 size 就不再看 resolution / aspect_ratio;不带 callback_url 时同一响应直接返回图 |
| image / images / image_urls | 否 | string / string[] | 参考图 1–16 张(网址或 data URI);每张宽高 128–8192 像素、长边不超过短边 4 倍、不超过 64 MB |
| output_format | 否 | string | jpeg(默认)/ png / webp |
| output_compression | 否 | integer | 0–100,默认 95,越大画质越高、文件越大;只对 jpeg / webp 生效 |
| disable_prompt_enhanced | 否 | boolean | true = 关闭提示词增强;只用于文生图,且必须同时给 aspect_ratio(X:Y)或 size |
| aigc_watermark | 否 | boolean | true = 在图上加可见的 AIGC 标识水印,默认 false;写在文件元数据里的隐式标识始终存在 |
| response_format | 否 | string | 一次调用模式下:b64_json(默认,同时给 url)或 url |
| callback_url | 否 | string | 任务完成后的 webhook 回调 URL |
限制
- 不支持遮罩局部重绘(mask / mask_url)、透明背景(background: "transparent")、反向提示词(negative_prompt)和 seed,传了返回 400。
- n 超过 10、参考图超过 16 张、比例超出 1:3–3:1、size 面积超出 655,360–20,000,000 像素,都返回 400。
- 改图始终开提示词增强;disable_prompt_enhanced 只用于文生图。
- 没有 seed,同一个请求每次出的图都不一样。
- 做不到的参数一律返回 400 并写明原因,不会被悄悄忽略。
不保证每次都成功
提示词或图片可能被内容审核拒绝,上游偶尔会临时出错。一次多张时只收出成的那几张;整单失败不扣费,冻结的额度退回,返回里带失败原因:审核类改提示词或换图再试,临时错误直接重试。结果文件保留 30 天后自动删除,请及时下载或转存。
试一试:MiniMax H3 Image / Highspeed(试用区每次出 1 张;一次多张、精确尺寸、PNG / WebP 请用 API)。要透明背景的素材,见 Seedream 5.5。
常见问题
MiniMax H3 Image 怎么改图?
向 /v1/images/generations 发请求,model 填 minimax-h3-image,提示词写清要改什么,原图放在 image(多张放 images,最多 16 张,提示词里按「图1、图2」指代)。每张参考图加 $0.01(高速版 $0.015)。
MiniMax H3 Image 多少钱?
标准版:1K 或 2K 每张 $0.03、4K $0.10,每张参考图加 $0.01。高速版:$0.05 和 $0.18,每张参考图加 $0.015。只对出成的图收费,失败不扣费。
能一次调用直接拿到图吗?
能:传精确尺寸(如 2720x1536)且不带 callback_url,或用 OpenAI SDK 的 images.generate 并把 base_url 设为 https://api.apimodels.app/v1。否则返回 taskId 再轮询。