wan2.7-image-pro

POST /v1/images/generations

MethodPOST
Path/v1/images/generations
Typehttp
Status-2
Module2102810
Folder84901430

概览

MethodPOST
Path/v1/images/generations
Typehttp
Status-2
Module2102810
Folder84901430

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "title": "wan2.7-image-pro 文生图请求",
    "type": "object",
    "additionalProperties": false,
    "required": [
      "model",
      "prompt"
    ],
    "properties": {
      "model": {
        "type": "string",
        "const": "wan2.7-image-pro",
        "title": "模型",
        "description": "固定为 wan2.7-image-pro",
        "x-apifox-enum": [
          {
            "value": "wan2.7-image-pro",
            "name": "Wan 2.7 Image Pro",
            "description": "阿里百炼万相 2.7 专业版"
          }
        ]
      },
      "prompt": {
        "type": "string",
        "minLength": 1,
        "title": "提示词",
        "description": "【必填】文生图正向提示词"
      },
      "size": {
        "type": "string",
        "title": "分辨率",
        "description": "可选。① 档位:1K / 2K(默认)/ 4K(仅文生图)② 像素:1920*1080 或 1920x1080(注:支持指定像素,总像素在 [768 * 768, 4096 * 4096] 之间,宽高比范围为 [1:8, 8:1])",
        "examples": [
          "2K",
          "4K",
          "1920*1080"
        ],
        "x-apifox-enum": [
          {
            "value": "1K",
            "name": "1K",
            "description": "约 1024×1024"
          },
          {
            "value": "2K",
            "name": "2K(默认)",
            "description": "约 2048×2048"
          },
          {
            "value": "4K",
            "name": "4K",
            "description": "仅文生图、无参考图"
          }
        ]
      },
      "n": {
        "type": "integer",
        "minimum": 1,
        "maximum": 4,
        "default": 1,
        "title": "生成张数",
        "description": "1-4,默认 1"
      },
      "watermark": {
        "type": "boolean",
        "default": false,
        "title": "水印",
        "description": "false=无水印(上游默认),true=添加「AI生成」水印",
        "x-apifox-enum": [
          {
            "value": false,
            "name": "无水印",
            "description": "推荐"
          },
          {
            "value": true,
            "name": "加水印",
            "description": ""
          }
        ]
      },
      "seed": {
        "type": "integer",
        "minimum": 0,
        "maximum": 2147483647,
        "title": "随机种子",
        "description": "可选,相同 seed 可提高可复现性"
      }
    },
    "x-apifox-orders": [
      "model",
      "prompt",
      "size",
      "n",
      "watermark",
      "seed"
    ]
  },
  "required": true,
  "mediaType": "",
  "examples": [
    {
      "mediaType": "application/json",
      "value": "{\r\n  \"model\": \"wan2.7-image-pro\",\r\n  \"prompt\": \"一间有着精致窗户的花店,漂亮的木质门,摆放着花朵\"\r\n}",
      "name": "新手推荐:文生图 · 默认 2K"
    },
    {
      "name": "新手推荐:文生图 · size=4K",
      "value": "{\r\n    \"model\": \"wan2.7-image-pro\",\r\n    \"prompt\": \"雪山湖泊日出,写实摄影\",\r\n    \"size\": \"4K\"\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "新手推荐:文生图 · 像素16:9",
      "value": "{\r\n    \"model\": \"wan2.7-image-pro\",\r\n    \"prompt\": \"宽银幕城市夜景\",\r\n    \"size\": \"1920*1080\",\r\n    \"watermark\": false\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:种子使用 · 组合 · 2K×1×固定seed",
      "value": "{\r\n    \"model\": \"wan2.7-image-pro\",\r\n    \"prompt\": \"相同种子复现测试,红色玫瑰\",\r\n    \"size\": \"2K\",\r\n    \"n\": 1,\r\n    \"watermark\": false,\r\n    \"seed\": 42\r\n}",
      "mediaType": "application/json"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 147258193,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "$id": "https://yunwu-api.local/schemas/v1-images-generations-wan2.7-image-pro.response.json",
      "title": "POST /v1/images/generations · wan2.7-image-pro 成功响应",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "created",
        "data"
      ],
      "properties": {
        "created": {
          "type": "integer",
          "description": "Unix 时间戳(秒)"
        },
        "data": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/imageData"
          }
        }
      },
      "$defs": {
        "imageData": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "url": {
              "type": "string",
              "format": "uri",
              "description": "图片 URL(OSS 临时链接,官方保留约 24 小时,请及时下载)"
            },
            "b64_json": {
              "type": "string",
              "description": "Base64 图片(仅当 response_format=b64_json 且渠道支持时)"
            },
            "revised_prompt": {
              "type": "string",
              "description": "修订提示词;本模型通常为空字符串"
            }
          },
          "x-apifox-orders": [
            "url",
            "b64_json",
            "revised_prompt"
          ]
        }
      },
      "examples": [
        {
          "name": "成功-单张URL",
          "value": {
            "created": 1710000000,
            "data": [
              {
                "url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.png?Expires=xxx",
                "revised_prompt": ""
              }
            ]
          }
        }
      ],
      "x-apifox-orders": [
        "created",
        "data"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": []
  }
]

响应示例

[
  {
    "name": "服务器内部错误",
    "responseId": 147258193,
    "data": "{\"error\":{\"message\":\"invalid request body: json: cannot unmarshal string into Go struct field GeneralOpenAIRequest.response_format of type dto.ResponseFormat (request id: 20260507163239913971004ZVwereT)\",\"type\":\"new_api_error\",\"param\":\"\",\"code\":\"invalid_request\"}}",
    "id": "019e0191-572e-7466-860c-dc105d4511da"
  }
]