跳转到主要内容
万相2.6

Wan 2.6 — 同步调用

Wan 2.6 同步图像生成与编辑

POST
/services/aigc/multimodal-generation/generation
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--data '{
  "model": "wan2.6-image",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "text": "Generate a tomato and egg stir-fry based on the style of image 1 and the background of image 2"
          },
          {
            "image": "https://cdn.wanx.aliyuncs.com/tmp/pressure/umbrella1.png"
          },
          {
            "image": "https://img.alicdn.com/imgextra/i3/O1CN01SfG4J41UYn9WNt4X1_!!6000000002530-49-tps-1696-960.webp"
          }
        ]
      }
    ]
  },
  "parameters": {
    "prompt_extend": true,
    "watermark": false,
    "n": 1,
    "enable_interleave": false,
    "size": "1K"
  }
}'
{
  "output": {
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "content": [
            {
              "image": "https://dashscope-result.oss-cn-shanghai.aliyuncs.com/xxx.png?Expires=xxx",
              "type": "image"
            }
          ],
          "role": "assistant"
        }
      }
    ],
    "finished": true
  },
  "usage": {
    "image_count": 1,
    "input_tokens": 0,
    "output_tokens": 0,
    "size": "1376*768",
    "total_tokens": 0
  },
  "request_id": "a3f4befe-cacd-49c9-8298-xxxxxx"
}
获取 API Key设置为环境变量。如需使用 SDK,请先安装 SDK
此同步接口仅适用于 wan2.6-image 模型,可在单次请求中直接获取生成的图像,无需轮询。 如需异步处理,请使用异步提交接口。

鉴权

string
header
必填

千问云 API Key。详见获取 API Key

请求体

application/json
enum<string>
必填

模型名称。设置为 wan2.6-image

wan2.6-image
wan2.6-image
object
必填

包含消息数组的输入数据。

object

图像处理参数。

响应

200-application/json
object
object

用量统计。

string
默认值"a3f4befe-cacd-49c9-8298-xxxxxx"

用于追踪和排查问题的唯一请求标识符。

a3f4befe-cacd-49c9-8298-xxxxxx