图像(Images)/原生OpenAI格式 编辑图像 在给定原始图像和提示的情况下创建编辑或扩展图像。 接口 POST /v1/images/edits/ 用途 用于 GPT Image / Image2 相关的图片生成或编辑。 前提 密钥需加入 GPT 生图分组;普通 default 分组不可直接调用。 建议 图片接口会产生生成成本,联调用例应控制尺寸、数量和重试次数。 POST / v1 / images / edits Try it Authorizations ​ Authorization stringheaderrequired Bearer authentication header of the form Bearer , where is your auth token. Body multipart/form-data ​ image filerequired 要编辑的图像。必须是有效的 PNG 文件,小于 4MB,并且是方形的。如果未提供遮罩,图像必须具有透明度,将用作遮罩。 ​ prompt stringrequired 所需图像的文本描述。最大长度为 1000 个字符。 Example: "A cute baby sea otter wearing a beret." ​ mask file 附加图像,其完全透明区域(例如,alpha 为零的区域)指示image应编辑的位置。必须是有效的 PNG 文件,小于 4MB,并且尺寸与原始image相同。 ​ n string 要生成的图像数。必须介于 1 和 10 之间。 Example: "1" ​ size string 生成图像的大小。必须是256x256、512x512或 1024x1024之一。 Example: "1024x1024" ​ response_format string 生成的图像返回的格式。必须是url或b64_json。 Example: "url" ​ user string 代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。了解更多。 Example: "" ​ model string Example: "dall-e-2" Response 200 - application/json The response is of type object. curl --request POST \ --url https://www.yunqiai.chat/v1/images/edits/ \ --header 'Authorization: Bearer ' \ --header 'Content-Type: multipart/form-data' \ --form image='@example-file' \ --form 'prompt=A cute baby sea otter wearing a beret.' \ --form n=1 \ --form size=1024x1024 \ --form response_format=url \ --form user= \ --form model=dall-e-2 curl --request POST \ --url https://www.yunqiai.chat/v1/images/edits/ \ --header 'Authorization: Bearer ' \ --header 'Content-Type: multipart/form-data' \ --form image='@example-file' \ --form 'prompt=A cute baby sea otter wearing a beret.' \ --form n=1 \ --form size=1024x1024 \ --form response_format=url \ --form user= \ --form model=dall-e-2