Qwen 和 Wan 图片模型

以 Markdown 格式查看

Qwen 和 Wan 图片模型使用带有 input.messages 载荷的图片生成端点。qwen-image-2.0qwen-image-2.0-prowan2.7-imagewan2.7-image-pro 使用相同请求结构;在 parameters 内选择模型专属选项。

curl --location --request POST "https://api.getopenmodels.com/v1/images" \
--header "Authorization: Bearer $OM_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "qwen-image-2.0-pro",
"route": { "provider": "<provider-for-this-model>" },
"route_mode": "balanced",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "Create a high-quality ecommerce poster for a white ceramic coffee cup, clean layout, realistic lighting, clear Chinese and English typography."
}
]
}
]
},
"parameters": {
"n": 1,
"watermark": false,
"size": "2048*2048",
"negative_prompt": "low resolution, blurry text, distorted hands, cluttered composition",
"prompt_extend": true
}
}'

对于 Wan 模型,请使用相同载荷结构并切换到 Wan 专属参数值:

curl --location --request POST "https://api.getopenmodels.com/v1/images" \
--header "Authorization: Bearer $OM_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "wan2.7-image-pro",
"route": { "provider": "<provider-for-this-model>" },
"route_mode": "balanced",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "A cinematic product photo of a premium black ceramic coffee cup on a marble table, soft side lighting, luxury ecommerce style."
}
]
}
]
},
"parameters": {
"n": 1,
"watermark": false,
"size": "2K",
"thinking_mode": true
}
}'

对于 Qwen 和 Wan 图片模型,请在 parameters 中设置输出选项。

字段类型备注
modelstring支持的值:qwen-image-2.0qwen-image-2.0-prowan2.7-imagewan2.7-image-pro
input.messagesarray必填。使用单个带有 content 部分的用户消息。
input.messages[].content[].textstring文生图提示词必填。Qwen 2.0 提示词最多支持 1300 tokens;Wan 提示词最多支持 5000 个字符。
input.messages[].content[].imagestring图片编辑或参考图工作流的可选图片输入,前提是所选模型路由支持图片输入。使用公开图片 URL 或 base64 Data URL。
parameters.ninteger图片数量。Qwen 2.0 当前要求为 1;Wan 在组图生成关闭时支持 1-4,当 enable_sequential 为 true 时支持 1-12
parameters.sizestring输出大小。Qwen 2.0 使用明确像素大小,例如 2048*20482688*15361536*2688。Wan 支持 1K2Kwan2.7-image-pro 也支持文生图的 4K。Wan 还接受在像素限制内的自定义 WIDTH*HEIGHT 值。
parameters.watermarkboolean是否添加水印。默认值:false
parameters.seedinteger[0, 2147483647] 范围内的可选随机种子。固定 seed 可提高可复现性,但不保证结果完全相同。
parameters.negative_promptstringQwen 专属负面提示词,用于描述要避免的内容。
parameters.prompt_extendbooleanQwen 专属提示词优化开关。默认值:true
parameters.enable_sequentialbooleanWan 专属组图生成开关。默认值:false
parameters.thinking_modebooleanWan 专属质量模式。默认值:true;仅当组图生成关闭时适用。
parameters.color_palettearrayWan 专属色彩主题控制。提供 3-10 个包含 hexratio 的颜色对象;所有比例必须合计为 100.00%