# GPT Image 2.5 Sunburst 图像生成

> 图像生成

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

## 请求地址

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

## 请求体

## 响应

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

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "gpt-image-2.5-sunburst接口文档",
    "version": "1.0.0",
    "description": "这是 ModelVerse 上 `gpt-image-2.5-sunburst` 的图片接口文档，说明如何发起图片生成或编辑请求、填写参数、读取结果以及处理错误。\\r\\n    接口路径包括 `POST /v1/images/generations`、`POST /v1/images/edits`。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "该模型文档中使用的 ModelVerse API 端点。"
    }
  ],
  "tags": [
    {
      "name": "gpt-image-2.5-sunburst",
      "description": "使用 gpt-image-2.5-sunburst 进行图像生成、局部图像编辑和多图像合成。"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/images/generations": {
      "post": {
        "tags": [
          "gpt-image-2.5-sunburst"
        ],
        "operationId": "createGptImage25SunburstImageGeneration",
        "summary": "GPT Image 2.5 Sunburst 图像生成",
        "description": "发起图片生成请求。请求体包含模型、提示词和可选生成参数，响应返回 Base64 图像数据。\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GptImage25SunburstGenerationRequest"
              },
              "examples": {
                "flower": {
                  "summary": "生成 PNG 图像",
                  "value": {
                    "model": "gpt-image-2.5-sunburst",
                    "prompt": "a beautiful flower",
                    "size": "1024x1024",
                    "quality": "high",
                    "background": "transparent",
                    "output_format": "png",
                    "output_compression": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "图像生成响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage25SunburstImagesResponse"
                },
                "examples": {
                  "generatedImage": {
                    "summary": "带 token 用量的生成图像",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "b64_json": "{image_base64_string}"
                        }
                      ],
                      "background": "transparent",
                      "output_format": "png",
                      "quality": "high",
                      "size": "1024x1024",
                      "usage": {
                        "total_tokens": 4169,
                        "input_tokens": 9,
                        "output_tokens": 4160,
                        "input_tokens_details": {
                          "text_tokens": 9
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "无效请求参数或生成错误。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage25SunburstErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage25SunburstError"
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage25SunburstErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage25SunburstError"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "gpt-image-2.5-sunburst"
        ],
        "operationId": "createGptImage25SunburstImageEdit",
        "summary": "GPT Image 2.5 Sunburst 图像编辑",
        "description": "发起图片编辑请求。通过 multipart 上传图片和可选 mask，响应返回编辑后的图片结果。\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/GptImage25SunburstEditRequest"
              },
              "encoding": {
                "image": {
                  "contentType": "image/png"
                },
                "mask": {
                  "contentType": "image/png"
                },
                "image[]": {
                  "contentType": "image/png",
                  "style": "form",
                  "explode": true
                }
              },
              "examples": {
                "localizedEdit": {
                  "summary": "带可选遮罩的局部编辑",
                  "value": {
                    "image": "/path/to/your/image.png",
                    "mask": "/path/to/your/mask.png",
                    "model": "gpt-image-2.5-sunburst",
                    "prompt": "Add a beach ball in the center",
                    "size": "1024x1024",
                    "n": 1,
                    "quality": "low",
                    "background": "opaque",
                    "output_format": "png",
                    "output_compression": 100
                  }
                },
                "multiImageComposition": {
                  "summary": "通过重复 image[] 合成多张图片",
                  "value": {
                    "model": "gpt-image-2.5-sunburst",
                    "image[]": [
                      "./body-lotion.png",
                      "./bath-bomb.png",
                      "./incense-kit.png",
                      "./soap.png"
                    ],
                    "prompt": "a beautiful gift basket containing all these products arranged elegantly"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "图像编辑响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage25SunburstImagesResponse"
                },
                "examples": {
                  "editedImage": {
                    "summary": "带 token 用量的编辑图像",
                    "value": {
                      "created": 1750668025,
                      "data": [
                        {
                          "b64_json": "{edited_image_base64}"
                        }
                      ],
                      "background": "opaque",
                      "output_format": "png",
                      "quality": "low",
                      "size": "1024x1024",
                      "usage": {
                        "total_tokens": 8290,
                        "input_tokens": 4170,
                        "output_tokens": 4120,
                        "input_tokens_details": {
                          "text_tokens": 10,
                          "image_tokens": 4160
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "无效请求参数或编辑错误。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage25SunburstErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage25SunburstError"
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GptImage25SunburstErrorResponse"
                },
                "examples": {
                  "documentedError": {
                    "$ref": "#/components/examples/GptImage25SunburstError"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GptImage25SunburstModel": {
        "type": "string",
        "enum": [
          "gpt-image-2.5-sunburst"
        ],
        "description": "用于图像生成的模型。支持 gpt-image-2.5-sunburst 及其快照版本。\n"
      },
      "GptImage25SunburstPrompt": {
        "type": "string",
        "maxLength": 32000,
        "description": "所需图像的文本描述。gpt-image-2.5-sunburst 最大长度为 32000 字符。\n"
      },
      "GptImage25SunburstImageCount": {
        "type": "integer",
        "minimum": 1,
        "maximum": 10,
        "default": 1,
        "description": "要生成的图像数量。必须在 1 到 10 之间。\n"
      },
      "GptImage25SunburstSize": {
        "type": "string",
        "default": "auto",
        "description": "生成图像的尺寸。支持任意分辨率 `WIDTHxHEIGHT` 格式（如 1536x864）。\n宽度和高度必须都能被 16 整除，宽高比必须在 1:3 到 3:1 之间。\n最大支持分辨率为 3840x2160。\n",
        "x-max-aspect-ratio": "3:1",
        "x-min-aspect-ratio": "1:3",
        "oneOf": [
          {
            "const": "auto"
          },
          {
            "pattern": "^[1-9][0-9]*x[1-9][0-9]*$"
          }
        ],
        "examples": [
          "1024x1024",
          "1024x1536",
          "1536x1024",
          "2048x2048",
          "2048x1152",
          "2160x3840",
          "2560x1440",
          "3840x2160"
        ]
      },
      "GptImage25SunburstQuality": {
        "type": "string",
        "enum": [
          "low",
          "medium",
          "high",
          "xhigh",
          "max"
        ],
        "description": "图像质量。\n- `low`: 低质量\n- `medium`: 中等质量\n- `high`: 高质量（可能需要更长时间）\n- `xhigh`: 超高质量\n- `max`: 最高质量\n"
      },
      "GptImage25SunburstBackground": {
        "type": "string",
        "enum": [
          "transparent",
          "opaque",
          "auto"
        ],
        "default": "auto",
        "description": "生成图像的背景设置。\n- `transparent`: 透明背景（需设置 output_format 为 png）\n- `opaque`: 不透明背景\n- `auto`: 自动决定最佳背景（默认值）\n"
      },
      "GptImage25SunburstModeration": {
        "type": "string",
        "enum": [
          "low",
          "auto"
        ],
        "default": "auto",
        "description": "内容审核级别。\n- `low`: 较少限制的过滤\n- `auto`: 默认审核级别\n"
      },
      "GptImage25SunburstOutputFormat": {
        "type": "string",
        "enum": [
          "png",
          "jpeg"
        ],
        "default": "png",
        "description": "输出图像格式。\n"
      },
      "GptImage25SunburstOutputCompression": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100,
        "default": 100,
        "description": "图像压缩强度（0-100%）。仅支持 jpeg 格式。`0` 禁用压缩，`100` 应用最大压缩。\n"
      },
      "GptImage25SunburstGenerationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "$ref": "#/components/schemas/GptImage25SunburstModel"
          },
          "prompt": {
            "$ref": "#/components/schemas/GptImage25SunburstPrompt"
          },
          "n": {
            "$ref": "#/components/schemas/GptImage25SunburstImageCount"
          },
          "size": {
            "$ref": "#/components/schemas/GptImage25SunburstSize"
          },
          "quality": {
            "$ref": "#/components/schemas/GptImage25SunburstQuality"
          },
          "background": {
            "$ref": "#/components/schemas/GptImage25SunburstBackground"
          },
          "moderation": {
            "$ref": "#/components/schemas/GptImage25SunburstModeration"
          },
          "output_format": {
            "$ref": "#/components/schemas/GptImage25SunburstOutputFormat"
          },
          "output_compression": {
            "$ref": "#/components/schemas/GptImage25SunburstOutputCompression"
          }
        }
      },
      "GptImage25SunburstEditRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "prompt"
        ],
        "anyOf": [
          {
            "required": [
              "image"
            ]
          },
          {
            "required": [
              "image[]"
            ]
          }
        ],
        "properties": {
          "image": {
            "type": "string",
            "format": "binary",
            "description": "单图局部编辑时要编辑的图像文件。"
          },
          "image[]": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "format": "binary"
            },
            "description": "多图合成时可重复传入的 multipart `image` 字段。"
          },
          "mask": {
            "type": "string",
            "format": "binary",
            "description": "可选的 mask 文件，用于限制单图局部编辑区域。"
          },
          "model": {
            "$ref": "#/components/schemas/GptImage25SunburstModel"
          },
          "prompt": {
            "$ref": "#/components/schemas/GptImage25SunburstPrompt"
          },
          "n": {
            "$ref": "#/components/schemas/GptImage25SunburstImageCount"
          },
          "size": {
            "$ref": "#/components/schemas/GptImage25SunburstSize"
          },
          "quality": {
            "$ref": "#/components/schemas/GptImage25SunburstQuality"
          },
          "background": {
            "$ref": "#/components/schemas/GptImage25SunburstBackground"
          },
          "moderation": {
            "$ref": "#/components/schemas/GptImage25SunburstModeration"
          },
          "output_format": {
            "$ref": "#/components/schemas/GptImage25SunburstOutputFormat"
          },
          "output_compression": {
            "$ref": "#/components/schemas/GptImage25SunburstOutputCompression"
          }
        }
      },
      "GptImage25SunburstImagesResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "请求创建时的 Unix 时间戳（秒）。"
          },
          "data": {
            "type": "array",
            "minItems": 1,
            "description": "生成的图像数据。文档中 gpt-image-2.5-sunburst 的响应返回 base64 图像数据。",
            "items": {
              "$ref": "#/components/schemas/GptImage25SunburstImageData"
            }
          },
          "background": {
            "type": "string",
            "enum": [
              "transparent",
              "opaque"
            ],
            "description": "生成图像的背景类型。"
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png",
              "jpeg"
            ],
            "description": "输出图像格式。"
          },
          "quality": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "description": "图像质量。"
          },
          "size": {
            "type": "string",
            "description": "图像尺寸。"
          },
          "usage": {
            "$ref": "#/components/schemas/GptImage25SunburstUsage"
          }
        }
      },
      "GptImage25SunburstImageData": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "b64_json"
        ],
        "properties": {
          "b64_json": {
            "type": "string",
            "description": "Base64 编码图像数据，可带 data URL 前缀。"
          }
        }
      },
      "GptImage25SunburstUsage": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "total_tokens": {
            "type": "integer"
          },
          "input_tokens": {
            "type": "integer"
          },
          "output_tokens": {
            "type": "integer"
          },
          "input_tokens_details": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "text_tokens": {
                "type": "integer"
              },
              "image_tokens": {
                "type": "integer"
              }
            }
          },
          "output_tokens_details": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "text_tokens": {
                "type": "integer"
              },
              "image_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "GptImage25SunburstErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/GptImage25SunburstError"
          }
        }
      },
      "GptImage25SunburstError": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "message": {
            "type": "string",
            "description": "错误信息。"
          },
          "type": {
            "type": "string",
            "description": "错误类型。"
          },
          "param": {
            "type": "string",
            "description": "请求 ID 或相关参数。"
          },
          "code": {
            "type": "string",
            "description": "错误码。"
          }
        }
      }
    },
    "examples": {
      "GptImage25SunburstError": {
        "summary": "文档中的错误响应",
        "value": {
          "error": {
            "message": "error_message",
            "type": "error_type",
            "param": "request_id",
            "code": "error_code"
          }
        }
      }
    }
  }
}
```
