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 張符合支援格式和尺寸要求的參考圖像