Skip to content

Image-01(MiniMax 图片)

参考:文生图图生图。同一接口,图生图时传入 subject_reference 作为人物主体参考。

URL/v1/image_generation

MethodPOST

请求参数

参数类型必填说明
modelstring模型名称。可选值:image-01
promptstring图像的文本描述,最长 1500 字符
subject_referencearray人物主体参考,用于图生图。每项为对象:type 当前仅支持 character(人像);image_file 为参考图,支持公网 URL 或 Base64 Data URL(data:image/jpeg;base64,…)。建议单人正面照,格式 JPG/JPEG/PNG,大小 < 10MB
aspect_ratiostring图像宽高比,默认 1:1。可选 1:116:94:33:22:33:49:1621:9
widthinteger生成图片宽度(像素)。仅 image-01 生效;需与 height 同时设置,取值范围 [512, 2048],且为 8 的倍数。与 aspect_ratio 同时设置时优先 aspect_ratio
heightinteger生成图片高度(像素)。仅 image-01 生效;需与 width 同时设置,取值范围 [512, 2048],且为 8 的倍数
response_formatstring返回形式,默认 url。可选 urlbase64。url 有效期为 24 小时
seedinteger随机种子。相同 seed 和参数可生成内容相近的图片,用于复现。未提供则对 n 张图分别生成随机种子
ninteger单次请求生成的图片数量,取值范围 [1, 9],默认 1
prompt_optimizerboolean是否开启 prompt 自动优化,默认 false
aigc_watermarkboolean是否在生成的图片中添加水印,默认 false

返回参数

参数类型必填说明
idstring生成任务的 ID,用于后续查询任务状态
dataobject返回数据。含 image_urls(response_format 为 url 时的图片链接数组)或 image_base64(为 base64 时的 Base64 数组)
metadataobjectsuccess_count:成功生成的图片数量;failed_count:因内容安全检查未返回的图片数量
base_respobjectstatus_code:0 成功,1002 限流,1004 鉴权失败,1008 余额不足,1026 描述敏感,2013 参数异常,2049 无效 api key 等;status_msg:具体错误详情。详见 错误码查询列表

cURL 示例

bash
curl -X POST "$BASE_URL/v1/image_generation" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "image-01",
    "prompt": "A watercolor painting of a mountain village after rain",
    "aspect_ratio": "16:9",
    "response_format": "url",
    "n": 1
  }'