创建 gpt-image-2-all

POST /v1/images/generations

MethodPOST
Path/v1/images/generations
Typehttp
Status1
Module2102810
Folder84826875

说明

给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。

为提供的提示和参数创建完成

官方文档:https://platform.openai.com/docs/api-reference/images/create

概览

MethodPOST
Path/v1/images/generations
Typehttp
Status1
Module2102810
Folder84826875

参数

{
  "query": [],
  "path": [],
  "cookie": [],
  "header": [
    {
      "id": "NQs7bxnpZf",
      "name": "Content-Type",
      "required": true,
      "description": "",
      "type": "string",
      "enable": true,
      "sampleValue": "application/json"
    },
    {
      "id": "qb8tEQbCty",
      "name": "Accept",
      "required": true,
      "description": "",
      "type": "string",
      "enable": true,
      "sampleValue": "application/json"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "gBxcCbXhsa",
      "enable": true,
      "name": "Authorization",
      "sampleValue": "Bearer {{YOUR_API_KEY}}"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "type": "object",
    "properties": {
      "model": {
        "type": "string",
        "description": "用于生成图像的模型。"
      },
      "size": {
        "type": "string",
        "description": "生成图像的尺寸。对于 GPT 图像模型,必须是 1024x1024 、 1536x1024 (横版)、 1024x1536 (竖版)"
      },
      "n": {
        "type": "integer",
        "description": "要生成的图像数量。"
      },
      "prompt": {
        "type": "string",
        "description": "所需图像的文本描述。"
      },
      "image": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "要编辑的图片。必须是受支持的图片文件或图片数组。最大可传5张。"
      }
    },
    "required": [
      "model",
      "prompt"
    ],
    "x-apifox-orders": [
      "model",
      "size",
      "n",
      "prompt",
      "image"
    ]
  },
  "required": false,
  "mediaType": "",
  "examples": [
    {
      "value": "{\n  \"model\": \"gpt-image-2-all\",\n  \"size\": \"1024x1024\",\n  \"n\": 1,\n  \"prompt\": \"将他们合并在一起\",\n  \"image\": [\n    \"https://imageproxy.zhongzhuan.chat/api/proxy/image/c42f4361295d6d70e3228498855c5814.png\",\n    \"https://imageproxy.zhongzhuan.chat/api/proxy/image/5b718c199e90b1fbbe06e7db9d88ebab.jpg\"\n  ]\n}",
      "mediaType": "application/json"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 666443878,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {
        "created": {
          "type": "integer"
        },
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "revised_prompt": {
                "type": "string"
              },
              "url": {
                "type": "string"
              }
            }
          }
        }
      },
      "required": [
        "created",
        "data"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]

响应示例

[
  {
    "name": "OK",
    "responseId": 666443878,
    "data": "{\r\n    \"created\": 1776909189,\r\n    \"data\": [\r\n        {\r\n            \"revised_prompt\": \"\",\r\n            \"url\": \"https://pro.filesystem.site/cdn/20260423/a8092bb17204bd0ed7cbd603c5b5c7.webp\"\r\n        }\r\n    ]\r\n}",
    "description": "",
    "oasKey": "",
    "oasExtensions": "",
    "id": 587196258
  }
]