MiniMax H3 Image API
MiniMax H3 Image 文生图和图像编辑模型的完整 API 参考文档。
模型版本
此 API 支持两个模型版本:
快速对比
支持的宽高比
1:1, 1:2, 2:1, 1:3, 3:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 9:21, 21:9
请分别通过数值型的 width 和 height 提供比例,而非像素尺寸。如果两个值均省略,宽高比默认为 1:1;否则,请使用受支持的整数对之一同时提供这两个值。
MiniMax H3 Image(文生图)
端点
POST /api/v1/image/task
身份验证
Authorization: Bearer YOUR_API_KEY
请求参数
必填
可选
注意: width:height 比例必须是上面列出的 15 种受支持比例之一。
请求示例
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'minimax-h3-image',
prompt: 'A serene mountain landscape at sunset',
width: 16,
height: 9,
resolution: '2k',
output_format: 'png'
})
});
const { data } = await response.json();
const taskId = data.task_id;
MiniMax H3 Image Edit(图像编辑)
端点
POST /api/v1/image/task
请求参数
必填
可选
注意: width:height 比例必须是上面列出的 15 种受支持比例之一。
请求示例
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'minimax-h3-image-edit',
prompt: 'Change the sky to sunset colors',
image_url_list: ['https://example.com/image.jpg'],
width: 16,
height: 9,
resolution: '2k',
output_format: 'png'
})
});
const { data } = await response.json();
const taskId = data.task_id;
单图编辑示例
{
model_name: 'minimax-h3-image-edit',
prompt: 'Change the sky to sunset colors',
image_url_list: ['https://example.com/image.jpg'],
width: 16,
height: 9,
resolution: '2k',
output_format: 'png'
}
多图合成示例
{
model_name: 'minimax-h3-image-edit',
prompt: 'Combine these images into a cohesive landscape',
image_url_list: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg'],
width: 16,
height: 9,
resolution: '2k',
output_format: 'png'
}
响应格式
初始响应
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}",
"task_status": "submitted"
}
}
轮询响应
轮询 GET /api/v1/image/{task_id} 以检查状态。成功的轮询响应会在 data.task_result.images[].url 中提供生成图像的 URL。
状态值
submitted:任务已接受
processing:正在生成图像
succeed:图像生成完成
failed:图像生成失败
最佳实践
- 详细的提示词:描述主体、光照和构图,将提示词控制在 5000 个字符以内
- 分辨率选择:在每次请求中明确传入
1k、2k 或 4k
- 宽高比:为
width 和 height 使用成对的比例值,或同时省略两者以使用 1:1
- 图像编辑质量:提供 1-16 张符合受支持格式和尺寸要求的参考图像