API 目录

创建 gpt-image-1.5

POST
/v1/images/generations

创建图像:gpt-image-1.5

POST https://www.vortapapi.com/v1/images/generations

使用 gpt-image-1.5 根据文本提示生成一张或多张图片。该接口兼容 OpenAI Images API 的图像生成请求格式。

请求头

名称必填说明
Content-Type固定使用 application/json
Accept建议使用 application/json
Authorization使用 Bearer Token,例如 Bearer sk-***

请求体

参数类型必填说明
modelstring要使用的图像模型,例如 gpt-image-1.5
promptstring用于生成图像的文本描述
ninteger要生成的图片数量
sizestring图片尺寸,例如 1024x1024
qualitystring图片质量配置,具体取值以模型支持为准
backgroundstring背景设置,具体取值以模型支持为准
response_formatstring返回图片的格式,例如 urlb64_json

请求示例

curl https://www.vortapapi.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sk-***" \
  -d '{
    "model": "gpt-image-1.5",
    "prompt": "一只橘猫坐在未来感城市的窗边,电影级光影",
    "n": 1,
    "size": "1024x1024"
  }'

响应示例

{
  "created": 1713833628,
  "data": [
    {
      "url": "https://example.com/generated-image.png"
    }
  ]
}

如果请求使用 response_format: "b64_json",响应中的图片数据会以 Base64 字符串形式返回:

{
  "created": 1713833628,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUg..."
    }
  ]
}