MAPI
图像(Images)异步图像任务

提交异步图像生成任务

提交图像生成任务,立即返回任务 ID,生成在后台执行,可通过查询接口轮询状态和结果。

入参格式与同步接口 /v1/images/generations 完全一致,可无缝切换。

POST
/v2/image-tasks

Authorization

BearerAuth

AuthorizationBearer <token>

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

In: header

Request Body

application/json

model*string

模型名称。

gpt-image-2

模型 ID说明
gpt-image-2OpenAI GPT Image 2

豆包 Seedream 系列

模型 ID说明
doubao-seedream-3-0-t2i-250415Seedream 3.0
doubao-seedream-4-5-t2i-250505Seedream 4.5
doubao-seedream-4-5-251128Seedream 4.5(增强版)
doubao-seedream-5-0-t2i-250804Seedream 5.0

Gemini 系列

模型 ID系列名说明
gemini-2.5-flash-imageNano BananaGemini 2.5 Flash Image
gemini-3-pro-imageNano Banana ProGemini 3 Pro Image
gemini-3.1-flash-imageNano Banana 2Gemini 3.1 Flash Image

Kling 系列

模型 ID说明
kling-image-2.1Kling Image 2.1
kling-image-3.0Kling Image 3.0
kling-image-3.0-omniKling Image 3.0 Omni,支持 auto 宽高比
kling-image-o1Kling Image O1,支持 auto 宽高比
kling-image-sceneKling Image Scene,扩图模式,需配合 extra_fields.scene_type="image_expand"

Vidu 系列

模型 ID说明
vidu-image-q2Vidu Q2

Qwen 系列

模型 ID说明
qwen-image-0925Qwen-Image-0925,通过 size 传自定义像素尺寸

Hunyuan 系列

模型 ID说明
hunyuan-image-3.0Hunyuan 3.0,通过 size 传自定义像素尺寸;支持全景图模式
prompt*string

图像描述提示词。豆包 Seedream 系列建议不超过 300 汉字或 600 英文单词。

image?string|

图生图 / 多图融合的输入图片,支持图片 URL 或 Base64 编码字符串。单张传字符串,多张传字符串数组(最多 14 张,视模型而定)。

豆包 Seedream 系列图片输入限制:

  • 支持格式:jpeg、png、webp、bmp、tiff、gif、heic、heif
  • 宽高比(宽/高)范围:[1/16, 16]
  • 宽高长度(px)> 14
  • 大小:不超过 30MB
  • 总像素:不超过 36000000px(6000x6000)
  • Seedream 5.0 pro 最多支持传入 10 张参考图;Seedream 5.0 lite / 4.5 / 4.0 最多支持传入 14 张参考图。

各模型参考图数量上限(超出将被自动截断):

模型最多参考图数
gemini-2.5-flash-image3 张
gemini-3-pro-image14 张
gemini-3.1-flash-image14 张
kling-image-2.14 张
kling-image-3.01 张
kling-image-3.0-omni10 张
kling-image-o110 张
kling-image-scene1 张(扩图原图)
vidu-image-q27 张
qwen-image-09251 张
hunyuan-image-3.03 张

超出上限的图片将被自动截断,请勿超量传入。

n?integer

生成图像数量。默认 1。

豆包 Seedream 系列n 映射为组图生成的 max_images(最多允许生成的张数上限),模型以 auto 模式根据 prompt 自主推理实际生成张数,最终张数 ≤ n。如需精确控制张数,建议在 prompt 中明确描述(如「生成 4 张不同风格的图片」)。支持范围 1-15。

Kling 系列:支持 1-9 张,超出自动截断。

OG(gpt-image-2):支持 1-8 张,超出自动截断。

其他模型(Gemini / Vidu / Qwen / Hunyuan 等):底层 API 不支持数量参数,n 字段传入后会被忽略,固定返回 1 张。

size?string

图像尺寸。

gpt-image-2:指定 宽x高,总像素数范围 655,360 – 8,294,400。

Gemini(GG)系列:映射到宽高比(AspectRatio),不支持自定义像素尺寸。 支持两种传入方式:

  • 直接传宽高比字符串(推荐),如 "1:1""16:9""9:16"
  • 传像素尺寸字符串,系统自动查表或计算最近邻宽高比,如 "1024x1024""1:1"

各版本支持的宽高比:

宽高比gemini-2.5-flash-imagegemini-3-pro-imagegemini-3.1-flash-image
1:1
2:3 / 3:2
3:4 / 4:3
4:5 / 5:4
9:16 / 16:9
21:9
1:4 / 4:1
1:8 / 8:1

默认值 "1:1"。传入不支持的宽高比时系统将回退到 "1:1" 并记录日志。

Kling 系列kling-image-2.1 / 3.0 / 3.0-omni / o1):映射到宽高比(AspectRatio)。 支持直接传宽高比字符串或像素尺寸(自动取最近邻)。

宽高比2.1 / 3.03.0-Omni / O1
1:1
2:3 / 3:2
3:4 / 4:3
9:16 / 16:9
21:9
auto✅(模型自动选择)

kling-image-scene 为扩图模式,size 参数无效,输出尺寸由扩图参数决定。

Vidu(vidu-image-q2:映射到宽高比(AspectRatio)。 支持:1:12:33:23:44:39:1616:921:9。默认 "1:1"

Qwen(qwen-image-0925:指定 宽x高 自定义像素尺寸,总像素范围 261,632 – 4,194,304(即 512×512 至 2048×2048)。不支持宽高比格式。

Hunyuan(hunyuan-image-3.0:指定 宽x高 自定义像素尺寸,宽高均在 [512, 2048] 范围内,且宽×高 ≤ 1,048,576(即 1024×1024)。不支持宽高比格式。

豆包 Seedream 系列:支持两种方式(不可混用):

方式一:分辨率档位标签(模型自动选择最佳宽高比)

档位doubao-seedream-3-0-*doubao-seedream-4-5-*doubao-seedream-5-0-*
1K✅(仅 pro)
2K
3K✅(仅 lite)
4K✅(仅 lite)

方式二:指定宽×高像素值

默认值 2048x2048(Seedream 3.0 默认 1024x1024)。常用推荐值:

档位1:116:99:164:33:4
2K2048x20482560x14401440x25602304x17281728x2304
4K4096x40965504x30403040x55044704x35203520x4704

Seedream 总像素范围:[3,686,400 – 16,777,216](最小约 2560×1440),宽高比范围 [1/16, 16]

response_format?string

结果返回格式。url(默认,返回图片下载链接,24小时有效)或 b64_json(返回 Base64 编码字符串)。查询接口返回的 images[] 中对应字段会按此格式填充。

quality?string

图像质量 / 分辨率档位。各模型语义不同:

Gemini(GG)系列:映射到分辨率档位(Resolution)。

  • 直接传档位(推荐):1K2K4Kgemini-3.1-flash-image 额外支持 720P
  • 兼容标准 quality 值:low / standard1Kmedium / hd / high2K
  • 默认值:1K

gpt-image-2:映射到图片精度档位。

  • low / standard → image2_low(最低精度)
  • medium → image2_medium
  • hd / high → image2_high(最高精度)
  • 默认值:standard(image2_low)

Kling 系列(除 scene):映射到分辨率档位(注意:使用小写)。

  • 直接传档位(推荐):1k2kkling-image-3.0-omni / kling-image-o1 额外支持 4k
  • 兼容标准 quality 值:low / standard / medium1khd / high2k
  • 默认值:1k
  • kling-image-scene(扩图模式)忽略此参数

Vidu(vidu-image-q2:映射到分辨率档位。

  • 直接传档位(推荐):1080p2K4K
  • 兼容标准 quality 值:low / standard1080pmedium / hd / high2K
  • 默认值:1080p

Qwen(qwen-image-0925)/ Hunyuan(hunyuan-image-3.0:不使用此参数(通过 size 传像素尺寸)。

其他模型lowmediumstandardhd / high。默认 standard

style?string

图像风格,如 vividnatural。部分模型支持。

output_format?string

输出图像文件格式。不传时跟随模型默认值。

gpt-image-2 / Kling 系列:支持 jpeg / png

豆包 Seedream 系列:支持 jpeg / png / webp;仅 doubao-seedream-5-0 系列支持。

其他模型:不支持,传入后忽略。

output_compression?integer

输出图像压缩质量(0-100),仅在 output_formatjpegwebp 时有效。部分模型支持。

watermark?boolean

是否在生成的图片上添加水印。豆包 Seedream 系列支持,默认 false

extra_fields?

模型扩展参数,不支持的字段将被忽略。

参数类型支持模型说明
guidance_scalenumber豆包 Seedream 系列引导强度,推荐取值范围 1-5
negative_promptstringgpt-image-2、Gemini 系列、Kling 系列反向提示词
seedintegergpt-image-2、Gemini 系列、Kling 系列随机种子,控制生成结果可复现性
enhance_promptstringGemini 系列自动优化 prompt,取值 Enabled / Disabled
scene_typestringKling scene、Hunyuan 3.0场景类型:image_expand(Kling 扩图)/ 3d_panorama(Hunyuan 全景图)
expansionobjectkling-image-scene扩图比例,配合 scene_type="image_expand" 使用,含 up / down / left / right 四个方向,取值范围 [0, 2],新图面积不超过原图 3 倍

Response Body

application/json

curl -X POST "https://loading/v2/image-tasks" \  -H "Content-Type: application/json" \  -d '{    "model": "doubao-seedream-4-5-251128",    "prompt": "一只橙色的猫坐在窗台上,背景是城市夜景"  }'
{
  "code": "success",
  "data": {
    "task_id": "task_aehCmxJ5YUNOIQGgkhvxaco4T9P2h3Dw",
    "status": "QUEUED",
    "progress": "0%",
    "model": "string",
    "images": [
      {
        "url": "string",
        "b64_json": "string"
      }
    ]
  }
}

最后更新于