# Qwen Image Edit 图像编辑

> 图像生成

发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。

## 请求地址

`POST https://api.modelverse.cn/v1/images/generations`

## 请求体

## 响应

- **200** — Image response.
- **400** — 请求参数无效或图像生成失败。
- **default** — 错误响应。

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "Qwen-Qwen-Image-Edit接口文档",
    "version": "1.0.0",
    "description": "这是 ModelVerse 上 `Qwen-Qwen-Image-Edit` 的图片接口文档，说明如何发起图片生成或编辑请求、填写参数、读取结果以及处理错误。\n接口路径包括 `POST /v1/images/generations`。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "该模型文档中使用的 ModelVerse API 端点。"
    }
  ],
  "tags": [
    {
      "name": "Qwen/Qwen-Image-Edit",
      "description": "Image editing requests with the Qwen/Qwen-Image-Edit model."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Qwen/Qwen-Image-Edit"
        ],
        "operationId": "createQwenQwenImageEditImageGeneration",
        "summary": "Qwen Image Edit 图像编辑",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QwenQwenImageEditRequest"
              },
              "examples": {
                "base64Image": {
                  "summary": "编辑a Base64 编码 PNG image",
                  "value": {
                    "model": "Qwen/Qwen-Image-Edit",
                    "prompt": "Convert to quick pencil sketch",
                    "image": "data:image/png;base64,{image_base64_string}",
                    "size": "1664x928"
                  }
                },
                "imageUrlWithSeed": {
                  "summary": "编辑an 图像 URL带a fixed seed",
                  "value": {
                    "model": "Qwen/Qwen-Image-Edit",
                    "prompt": "Turn the product photo into a clean watercolor illustration",
                    "image": "https://example.com/source.png",
                    "seed": 42,
                    "size": "1328x1328"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QwenQwenImageEditResponse"
                },
                "examples": {
                  "documentedResponse": {
                    "summary": "源文档响应示例",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "url": "https://xxxxx/xxxx.png",
                          "b64_json": "data:image/png;base64,{image_base64_string}"
                        }
                      ],
                      "usage": {
                        "input_tokens_details": {}
                      }
                    }
                  },
                  "urlResponse": {
                    "summary": "包含图像 URL 的响应",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "url": "https://xxxxx/xxxx.png"
                        }
                      ],
                      "usage": {
                        "input_tokens_details": {}
                      }
                    }
                  },
                  "base64Response": {
                    "summary": "包含 Base64 图像数据的响应",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "b64_json": "data:image/png;base64,{image_base64_string}"
                        }
                      ],
                      "usage": {
                        "input_tokens_details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效或图像生成失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QwenQwenImageEditErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/QwenQwenImageEditError"
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QwenQwenImageEditErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/QwenQwenImageEditError"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n"
      }
    },
    "schemas": {
      "QwenQwenImageEditModel": {
        "type": "string",
        "const": "Qwen/Qwen-Image-Edit",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n"
      },
      "QwenQwenImageEditPrompt": {
        "type": "string",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n",
        "examples": [
          "Convert to quick pencil sketch"
        ]
      },
      "QwenQwenImageEditImage": {
        "type": "string",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n",
        "examples": [
          "data:image/png;base64,{image_base64_string}",
          "https://example.com/source.png"
        ]
      },
      "QwenQwenImageEditSeed": {
        "type": "integer",
        "default": -1,
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n",
        "examples": [
          -1,
          42
        ]
      },
      "QwenQwenImageEditSize": {
        "type": "string",
        "default": "1664x928",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n",
        "enum": [
          "1664x928",
          "1472x1104",
          "1328x1328",
          "1104x1472",
          "928x1664"
        ]
      },
      "QwenQwenImageEditRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "prompt",
          "image"
        ],
        "properties": {
          "model": {
            "$ref": "#/components/schemas/QwenQwenImageEditModel"
          },
          "prompt": {
            "$ref": "#/components/schemas/QwenQwenImageEditPrompt"
          },
          "image": {
            "$ref": "#/components/schemas/QwenQwenImageEditImage"
          },
          "seed": {
            "$ref": "#/components/schemas/QwenQwenImageEditSeed"
          },
          "size": {
            "$ref": "#/components/schemas/QwenQwenImageEditSize"
          }
        }
      },
      "QwenQwenImageEditResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp in seconds for when the request was created."
          },
          "data": {
            "type": "array",
            "minItems": 1,
            "description": "Output image information. When the image is returned as a URL, the\nitem contains `url`; when returned as Base64 data, it contains\n`b64_json`. The source notes that generated links expire within\n7 days.\n",
            "items": {
              "$ref": "#/components/schemas/QwenQwenImageEditDataItem"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/QwenQwenImageEditUsage"
          }
        }
      },
      "QwenQwenImageEditDataItem": {
        "type": "object",
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "url"
            ]
          },
          {
            "required": [
              "b64_json"
            ]
          }
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "URL for downloading the generated image."
          },
          "b64_json": {
            "type": "string",
            "description": "Base64 image data, optionally prefixed as a data URL."
          }
        }
      },
      "QwenQwenImageEditUsage": {
        "type": "object",
        "additionalProperties": true,
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回图片 URL 或 Base64 图像数据。\n",
        "properties": {
          "input_tokens_details": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "QwenQwenImageEditErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/QwenQwenImageEditError"
          }
        }
      },
      "QwenQwenImageEditError": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "message": {
            "type": "string",
            "description": "错误信息。"
          },
          "type": {
            "type": "string",
            "description": "错误类型。"
          },
          "param": {
            "type": "string",
            "description": "请求 ID 或相关参数。"
          },
          "code": {
            "type": "string",
            "description": "错误码。"
          }
        }
      }
    },
    "examples": {
      "QwenQwenImageEditError": {
        "summary": "源文档错误响应",
        "value": {
          "error": {
            "message": "error_message",
            "type": "error_type",
            "param": "request_id",
            "code": "error_code"
          }
        }
      }
    }
  }
}
```
