给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
官方文档:https://platform.openai.com/docs/api-reference/images/createEdit
/v1/images/edits给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
官方文档:https://platform.openai.com/docs/api-reference/images/createEdit
curl -X POST https://top.qingyuntop.ai/v1/images/edits \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"size": "1024x1024",
"prompt": "一直可爱的小猪",
"model": "gpt-image-1",
"n": 1
}'| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Accept | Header | string | 是 | - | application/json |
Authorization | Header | string | 否 | - | Bearer {{YOUR_API_KEY}} |
image | 请求体 | file | 是 | 要编辑的图片。必须是受支持的图片文件或图片数组。对于 gpt-image-1,每张图片应为小于 25MB 的 png、webp 或 jpg 文件。对于 dall-e-2,您只能提供一张图片,并且该图片应为小于 4MB 的方形 png 文件。 | - |
prompt | 请求体 | string | 是 | 所需图像的文本描述。dall-e-2 的最大长度为 1000 个字符,gpt-image-1 的最大长度为 32000 个字符。 | 将他们合并在一个图片里面 |
mask | 请求体 | string | 否 | 一张附加图片,其完全透明区域(例如,alpha 值为零)指示应编辑 image 位置。如果提供了多张图片,则遮罩将应用于第一张图片。必须是有效的 PNG 文件,小于 4MB,且尺寸与 image 相同。 | - |
model | 请求体 | string | 否 | 用于生成图像的模型。仅 gpt-image-1, gpt-image-1-all , flux-kontext-pro , flux-kontext-max。 | gpt-image-1 |
n | 请求体 | string | 否 | 要生成的图像数量。必须介于 1 到 10 之间。 | 1 |
quality | 请求体 | string | 否 | 生成图像的质量。只有 gpt-image-1 支持 high、medium 和 low 质量。dall-e-2 仅支持 standard 质量。默认为 auto。 | - |
response_format | 请求体 | string | 否 | 返回生成图像的格式。必须是 url 或 b64_json 之一。URL 在图像生成后 60 分钟内有效。此参数仅适用于 dall-e-2,因为 gpt-image-1 始终返回 base64 编码的图像,请不要使用这个参数。 | b64_json |
size | 请求体 | string | 否 | 生成图像的尺寸。对于 GPT 图像模型,必须是 1024x1024 、 1536x1024 (横版)、 1024x1536 (竖版)或 auto (默认值)之一,对于 dall-e-2 必须是 256x256 、 512x512 或 1024x1024 之一,对于 dall-e-3 必须是 1024x1024 、 1792x1024 或 1024x1792 之一。 | 1024x1536 |
background | 请求体 | string | 否 | 允许为生成的图像的背景设置透明度。此参数仅在 gpt-image-1 中受支持。其值必须为 “透明(transparent)”、“不透明(opaque)” 或 “自动(auto)”(默认值)之一。当使用 “自动(auto)” 时,模型将自动为图像确定最佳背景。 | transparent |
moderation | 请求体 | string | 否 | 控制由 gpt-image-1 生成的图像的内容审核级别。可以设置为 “low” 以进行限制较少的过滤,也可以设置为 “auto”(默认值)。 | low |
image | JSON body | string | 是 | 要编辑的图片。必须是受支持的图片文件或图片数组。对于 gpt-image-1,每张图片应为小于 25MB 的 png、webp 或 jpg 文件。对于 dall-e-2,您只能提供一张图片,并且该图片应为小于 4MB 的方形 png 文件。 | - |
prompt | JSON body | string | 是 | 所需图像的文本描述。dall-e-2 的最大长度为 1000 个字符,gpt-image-1 的最大长度为 32000 个字符。 | - |
mask | JSON body | string | 是 | 一张附加图片,其完全透明区域(例如,alpha 值为零)指示应编辑 image 位置。如果提供了多张图片,则遮罩将应用于第一张图片。必须是有效的 PNG 文件,小于 4MB,且尺寸与 image 相同。 | - |
model | JSON body | string | 是 | 用于生成图像的模型。仅支持 dall-e-2 和 gpt-image-1。除非使用特定于 gpt-image-1 参数,否则默认为 dall-e-2。 | - |
n | JSON body | integer | 是 | 要生成的图像数量。必须介于 1 到 10 之间。 | - |
quality | JSON body | string | 是 | 生成图像的质量。只有 gpt-image-1 支持 high、medium 和 low 质量。dall-e-2 仅支持 standard 质量。默认为 auto。 | - |
response_format | JSON body | string | 是 | 返回生成图像的格式。必须是 url 或 b64_json 之一。URL 在图像生成后 60 分钟内有效。此参数仅适用于 dall-e-2,因为 gpt-image-1 始终返回 base64 编码的图像。 | - |
size | JSON body | string | 是 | 生成图像的尺寸。对于 gpt-image-1,必须为 1024x1024、1536x1024(横向)、1024x1536(纵向)或 auto(默认值)之一;对于 dall-e-2,必须为 256x256、512x512 或 1024x1024 之一。 | - |
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
id | 响应 JSON | string | 是 | - | - |
object | 响应 JSON | string | 是 | - | - |
created | 响应 JSON | integer | 是 | - | - |
choices | 响应 JSON | array<object> | 是 | - | - |
choices[].index | 响应 JSON | integer | 否 | - | - |
choices[].message | 响应 JSON | object | 否 | - | - |
choices[].message.role | 响应 JSON | string | 是 | - | - |
choices[].message.content | 响应 JSON | string | 是 | - | - |
choices[].finish_reason | 响应 JSON | string | 否 | - | - |
usage | 响应 JSON | object | 是 | - | - |
usage.prompt_tokens | 响应 JSON | integer | 是 | - | - |
usage.completion_tokens | 响应 JSON | integer | 是 | - | - |
usage.total_tokens | 响应 JSON | integer | 是 | - | - |
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497673313,
"name": "编辑 gpt-image-1",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。\n\n为提供的提示和参数创建完成\n\n官方文档:https://platform.openai.com/docs/api-reference/images/createEdit",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/v1/images/edits",
"tags": [],
"status": 1,
"requestBody": {
"type": "multipart/form-data",
"parameters": [
{
"id": "b3jXL90sE5",
"name": "image",
"required": true,
"enable": true,
"description": "要编辑的图片。必须是受支持的图片文件或图片数组。对于 gpt-image-1,每张图片应为小于 25MB 的 png、webp 或 jpg 文件。对于 dall-e-2,您只能提供一张图片,并且该图片应为小于 4MB 的方形 png 文件。\n",
"type": "file",
"schema": {
"format": "binary",
"type": "string"
}
},
{
"id": "TeGM3GrLP9",
"name": "prompt",
"required": true,
"enable": true,
"description": "所需图像的文本描述。dall-e-2 的最大长度为 1000 个字符,gpt-image-1 的最大长度为 32000 个字符。\n",
"type": "string",
"sampleValue": "将他们合并在一个图片里面"
},
{
"id": "i7NJKm41S6",
"name": "mask",
"required": false,
"enable": false,
"description": "一张附加图片,其完全透明区域(例如,alpha 值为零)指示应编辑 image 位置。如果提供了多张图片,则遮罩将应用于第一张图片。必须是有效的 PNG 文件,小于 4MB,且尺寸与 image 相同。\n",
"type": "string",
"sampleValue": ""
},
{
"id": "9puBSlhkv8",
"name": "model",
"required": false,
"enable": true,
"description": "用于生成图像的模型。仅 gpt-image-1, gpt-image-1-all , flux-kontext-pro , flux-kontext-max。\n",
"type": "string",
"sampleValue": "gpt-image-1"
},
{
"id": "UwcVbSRbom",
"name": "n",
"required": false,
"enable": true,
"description": "要生成的图像数量。必须介于 1 到 10 之间。\n",
"type": "string",
"sampleValue": "1"
},
{
"id": "NnJEH3V1Lk",
"name": "quality",
"required": false,
"enable": false,
"description": "生成图像的质量。只有 gpt-image-1 支持 high、medium 和 low 质量。dall-e-2 仅支持 standard 质量。默认为 auto。\n",
"type": "string",
"sampleValue": ""
},
{
"id": "zSKhx4jKxt",
"name": "response_format",
"required": false,
"enable": false,
"description": "返回生成图像的格式。必须是 url 或 b64_json 之一。URL 在图像生成后 60 分钟内有效。此参数仅适用于 dall-e-2,因为 gpt-image-1 始终返回 base64 编码的图像,请不要使用这个参数。\n",
"type": "string",
"sampleValue": "b64_json"
},
{
"id": "cBVZfsBqpM",
"name": "size",
"required": false,
"enable": true,
"description": "生成图像的尺寸。对于 GPT 图像模型,必须是 1024x1024 、 1536x1024 (横版)、 1024x1536 (竖版)或 auto (默认值)之一,对于 dall-e-2 必须是 256x256 、 512x512 或 1024x1024 之一,对于 dall-e-3 必须是 1024x1024 、 1792x1024 或 1024x1792 之一。\n\n",
"type": "string",
"sampleValue": "1024x1536"
},
{
"id": "eWjSCaxckX",
"name": "background",
"required": false,
"enable": false,
"description": "允许为生成的图像的背景设置透明度。此参数仅在 gpt-image-1 中受支持。其值必须为 “透明(transparent)”、“不透明(opaque)” 或 “自动(auto)”(默认值)之一。当使用 “自动(auto)” 时,模型将自动为图像确定最佳背景。\n",
"type": "string",
"sampleValue": "transparent"
},
{
"id": "R3LlLzVkmp",
"name": "moderation",
"required": false,
"enable": false,
"description": "控制由 gpt-image-1 生成的图像的内容审核级别。可以设置为 “low” 以进行限制较少的过滤,也可以设置为 “auto”(默认值)。\n",
"type": "string",
"sampleValue": "low"
}
],
"jsonSchema": {
"type": "object",
"properties": {
"image": {
"description": "要编辑的图片。必须是受支持的图片文件或图片数组。对于 gpt-image-1,每张图片应为小于 25MB 的 png、webp 或 jpg 文件。对于 dall-e-2,您只能提供一张图片,并且该图片应为小于 4MB 的方形 png 文件。",
"type": "string"
},
"prompt": {
"description": "所需图像的文本描述。dall-e-2 的最大长度为 1000 个字符,gpt-image-1 的最大长度为 32000 个字符。",
"type": "string"
},
"mask": {
"description": "一张附加图片,其完全透明区域(例如,alpha 值为零)指示应编辑 image 位置。如果提供了多张图片,则遮罩将应用于第一张图片。必须是有效的 PNG 文件,小于 4MB,且尺寸与 image 相同。",
"type": "string"
},
"model": {
"description": "用于生成图像的模型。仅支持 dall-e-2 和 gpt-image-1。除非使用特定于 gpt-image-1 参数,否则默认为 dall-e-2。",
"type": "string"
},
"n": {
"description": "要生成的图像数量。必须介于 1 到 10 之间。",
"type": "integer"
},
"quality": {
"description": "生成图像的质量。只有 gpt-image-1 支持 high、medium 和 low 质量。dall-e-2 仅支持 standard 质量。默认为 auto。",
"type": "string"
},
"response_format": {
"description": "返回生成图像的格式。必须是 url 或 b64_json 之一。URL 在图像生成后 60 分钟内有效。此参数仅适用于 dall-e-2,因为 gpt-image-1 始终返回 base64 编码的图像。",
"type": "string"
},
"size": {
"description": "生成图像的尺寸。对于 gpt-image-1,必须为 1024x1024、1536x1024(横向)、1024x1536(纵向)或 auto(默认值)之一;对于 dall-e-2,必须为 256x256、512x512 或 1024x1024 之一。",
"type": "string"
}
},
"required": [
"image",
"prompt",
"mask",
"model",
"n",
"quality",
"response_format",
"size"
],
"x-apifox-orders": [
"image",
"prompt",
"mask",
"model",
"n",
"quality",
"response_format",
"size"
]
},
"examples": [
{
"value": "{\n \"size\": \"1024x1024\",\n \"prompt\": \"一直可爱的小猪\",\n \"model\": \"gpt-image-1\",\n \"n\": 1\n}",
"mediaType": "application/json"
},
{
"value": "{\n \"size\": \"1024x1024\",\n \"prompt\": \"一直可爱的小猪\",\n \"model\": \"gpt-image-1\",\n \"n\": 1\n}",
"mediaType": "multipart/form-data",
"description": ""
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [],
"cookie": [],
"header": [
{
"id": "qb8tEQbCty",
"name": "Accept",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "application/json"
},
{
"id": "gBxcCbXhsa",
"name": "Authorization",
"required": false,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "Bearer {{YOUR_API_KEY}}"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {
"type": "noauth",
"noauth": {}
},
"responses": [
{
"id": 156429804,
"name": "OK",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"object": {
"type": "string"
},
"created": {
"type": "integer"
},
"choices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"index": {
"type": "integer"
},
"message": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": [
"role",
"content"
],
"x-apifox-orders": [
"role",
"content"
]
},
"finish_reason": {
"type": "string"
}
},
"x-apifox-orders": [
"index",
"message",
"finish_reason"
]
}
},
"usage": {
"type": "object",
"properties": {
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"required": [
"prompt_tokens",
"completion_tokens",
"total_tokens"
],
"x-apifox-orders": [
"prompt_tokens",
"completion_tokens",
"total_tokens"
]
}
},
"required": [
"id",
"object",
"created",
"choices",
"usage"
],
"x-apifox-orders": [
"id",
"object",
"created",
"choices",
"usage"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [
{
"name": "OK",
"responseId": 156429804,
"data": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\"\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21\n }\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fd25e-4be4-70ec-8a31-7c2191295738"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92749326,
"ordering": 6,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {},
"isDefaultUrlEncoding": 1
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-05T14:40:23.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}