图像生成
Wan 图像系列
通义 Wan 系列图像模型(图像编辑)
适用模型
| 模型 | 能力 | 说明 |
|---|---|---|
wan2.6-image | 图像编辑 | Wan 2.6 Image,基于输入图片(1-4 张)和文本指令生成/编辑图像 |
实际可用模型以模型列表为准。
请求协议
POST /v1/images/generations,DashScope 多模态协议(结构同 Qwen-Image 系列):提示词与输入图放在 input.messages,生成参数放在 parameters。
注意:该模型是图像编辑模型,不支持纯文生图——最后一条消息必须包含 1-4 张图片,只传文本会被上游拒绝(400,the last message must contain 1 to 4 images)。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | wan2.6-image |
input.messages[].content[].image | string | 是 | 输入图片,1-4 张;建议用 Base64 内联(data:image/...;base64,...),传 URL 时必须保证上游能直接下载到 |
input.messages[].content[].text | string | 是 | 编辑/生成指令 |
parameters.n | int | 否 | 生成张数,默认 1 |
parameters.size | string | 否 | 输出分辨率 宽*高;不传时上游自行决定(实测默认输出 1280*1280);影响平台计费档位 |
其余生成参数(negative_prompt、seed 等)原样透传,是否生效待实测确认。
请求示例
curl https://api.looptoken.cc/v1/images/generations \
-H "Authorization: Bearer $LOOPTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.6-image",
"input": {
"messages": [
{
"role": "user",
"content": [
{"image": "data:image/png;base64,iVBORw0KGgo..."},
{"text": "把背景改为星空,保持主体不变"}
]
}
]
},
"parameters": {"n": 1}
}'响应格式
DashScope 原生结构,图片为下载 URL(有效期有限,请尽快转存):
{
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {"role": "assistant", "content": [{"image": "https://...", "type": "image"}]}
}
],
"finished": true
},
"usage": {"image_count": 1, "size": "1280*1280", "input_tokens": 0, "output_tokens": 0, "total_tokens": 0},
"request_id": "..."
}