新一代统一 AI API 平台已上线 查看模型 →

GPT Image 2 API

GPT Image 2,支持图像生成能力,可通过统一 API 接入。

模型类型:✓ 图像生成异步任务
价格:最低 0.02 Credits / 次

使用统一 API Endpoint,通过 model: gpt-image-2 选择此模型。

使用 API 运行
分组只展示分组报价和平台认证标签
自动策略
平台自动
Input Images支持 Ctrl+V 粘贴图片,单张最大 5MB 最多 16 张
▧
点击上传或拖拽图片到这里支持 JPEG、PNG、WEBP单张最大 5MB,最多 16 张
HTTPS、站内文件或图片 data URL
尺寸 / 比例自动值使用接入规格的默认行为;也可选择比例或宽高。
分辨率按所选分辨率预算生成图片
渲染质量渲染质量会影响生成耗时与费用
数量 1生成图片数量(1–10)
12345678910
高级参数 3 项
背景
输出格式
蒙版透明 PNG;尺寸须与第一张参考图一致。 最多 1 张
▧
点击上传或拖拽图片到这里支持 PNG单张最大 5MB,最多 1 张
HTTPS、站内文件或图片 data URL
最低 0.02 Credits / 次
No Task Running
等待生成结果

填写左侧参数并开始运行,结果会在这里实时预览。

History 最多保留 20 条

0 运行中 · 0 已完成

完成第一次在线调试后,历史结果会显示在这里。

输入

文本图片
$ 定价
方案协议执行方式价格
GPT Image 2OpenAI Compatible异步任务

官方价 文本输入 5 / 图片输入 8 / 图片输出 30 USD / 1M Tokens

最低0.02Credits / 次
分组标签 / 官方价参考状态价格
【生图】特惠渠道分项价-- t/s71981 ms
最低0.02Credits / 次

按 Credits 扣费,外币按平台汇率展示;充值以通道报价为准。官方价参考为售价与官网价之比;价格已计入生效时段调整。

接入 GPT Image 2

Endpoint
/v1/images/generations
Model ID
gpt-image-2
cURL
curl https://xqapi.wkuola.workers.dev/v1/images/generations \
  -H "Authorization: Bearer $XQAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-image-2","prompt":"描述你想生成的内容"}'
当前模型参数 Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "model",
    "prompt"
  ],
  "properties": {
    "model": {
      "type": "string",
      "minLength": 1
    },
    "prompt": {
      "type": "string",
      "minLength": 1
    },
    "async": {
      "type": "boolean"
    },
    "routing": {
      "type": "object"
    },
    "stream": {
      "type": "boolean"
    },
    "response_format": {
      "type": "string",
      "enum": [
        "url",
        "b64_json"
      ]
    },
    "user": {
      "type": "string"
    },
    "size": {
      "title": "尺寸 / 比例",
      "type": "string",
      "pattern": "^(?:auto|[1-9]\\d*(?:\\.\\d+)?:[1-9]\\d*(?:\\.\\d+)?|[1-9]\\d*x[1-9]\\d*)$"
    },
    "resolution": {
      "title": "分辨率",
      "default": "auto",
      "x-xqapi-caseInsensitive": true,
      "x-xqapi-omitValues": [
        "auto"
      ],
      "type": "string",
      "enum": [
        "auto",
        "web",
        "1k",
        "2k",
        "4k"
      ]
    },
    "quality": {
      "title": "渲染质量",
      "default": "auto",
      "x-xqapi-omitValues": [
        "auto"
      ],
      "type": "string",
      "enum": [
        "auto",
        "low",
        "medium",
        "high"
      ]
    },
    "n": {
      "title": "数量",
      "type": "integer",
      "minimum": 1,
      "maximum": 10
    },
    "image_urls": {
      "title": "参考图",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(?:https://|/uploads/|data:image/)"
      },
      "maxItems": 16
    },
    "background": {
      "title": "背景",
      "x-xqapi-section": "advanced",
      "type": "string",
      "enum": [
        "auto",
        "opaque",
        "transparent"
      ]
    },
    "output_format": {
      "title": "输出格式",
      "x-xqapi-section": "advanced",
      "type": "string",
      "enum": [
        "png",
        "jpeg",
        "webp"
      ]
    },
    "output_compression": {
      "title": "压缩质量",
      "x-xqapi-section": "advanced",
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "mask_url": {
      "title": "蒙版",
      "description": "透明 PNG;尺寸须与第一张参考图一致。",
      "x-xqapi-section": "advanced",
      "type": "string",
      "pattern": "^(?:https://|/uploads/|data:image/)"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "background": {
            "enum": [
              "transparent"
            ]
          }
        },
        "required": [
          "background"
        ]
      },
      "then": {
        "properties": {
          "output_format": {
            "enum": [
              "png",
              "webp"
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "output_format": {
            "enum": [
              "jpeg",
              "webp"
            ]
          }
        },
        "required": [
          "output_format"
        ]
      },
      "then": {},
      "else": {
        "not": {
          "properties": {
            "output_compression": {}
          },
          "required": [
            "output_compression"
          ]
        }
      }
    },
    {
      "if": {
        "properties": {
          "mask_url": {}
        },
        "required": [
          "mask_url"
        ]
      },
      "then": {
        "properties": {
          "image_urls": {}
        },
        "required": [
          "image_urls"
        ]
      }
    }
  ]
}
阅读完整文档 →