KittyAPI

GPT Image 2 API 接入文档

兼容 OpenAI Images API。KittyAPI 网关同时提供文生图 Generations(POST /v1/images/generations)与图编辑 Edits(POST /v1/images/edits)。模型使用 gpt-image-2(或定点版本 gpt-image-2-2026-04-21)。适合电商主图、概念设计、营销物料、参考图精修与局部重绘。 查看接口文档、请求示例与模型市场中的当前价格。

接入信息

兼容 OpenAI Images API。KittyAPI 网关同时提供文生图 Generations(POST /v1/images/generations)与图编辑 Edits(POST /v1/images/edits)。模型使用 gpt-image-2(或定点版本 gpt-image-2-2026-04-21)。适合电商主图、概念设计、营销物料、参考图精修与局部重绘。

接口地址 POST /v1/images/generations

  • Generations 文生图
  • Edits 图编辑 / 局部重绘
  • 任意分辨率(16 像素对齐)
  • quality / background / input_fidelity
  • 默认返回 b64_json

Images Generations

POST /v1/images/generations

请求参数

  • prompt(string,必填) 期望图像的文本描述。GPT image 模型最长约 32000 字符。
  • model(string,选填) 图像模型。推荐 gpt-image-2,也可使用 gpt-image-2-2026-04-21 等定点版本。
  • n(number,选填) 生成数量,范围 1–10,默认 1。
  • size(string,选填) 输出尺寸。gpt-image-2 支持任意 WIDTHxHEIGHT:宽高均需被 16 整除,宽高比 1:3–3:1,最大约 3840x2160;超过 2560x1440 为实验范围。常用 1024x1024 / 1536x1024 / 1024x1536 / auto。
  • quality(string,选填) 画质:low | medium | high | auto(默认 auto)。仅 GPT image 模型支持 low/medium/high。
  • background(string,选填) 背景:transparent | opaque | auto。transparent 时 output_format 需为 png 或 webp。
  • output_format(string,选填) 输出格式:png | jpeg | webp。仅 GPT image 模型支持。
  • output_compression(number,选填) 压缩率 0–100,仅 webp/jpeg 生效,默认 100。
  • moderation(string,选填) 内容审核强度:low | auto(默认 auto)。
  • stream(boolean,选填) 是否流式返回。仅 GPT image 模型支持,默认 false。
  • partial_images(number,选填) 流式部分图数量 0–3。0 表示单次流式事件返回完整图。
  • user(string,选填) 终端用户标识,便于滥用监测。
  • response_format(string,选填) 仅 dall-e-2 / dall-e-3 使用(url | b64_json)。GPT image 模型不支持该参数,始终返回 base64(b64_json)。

请求示例

{
  "model": "gpt-image-2",
  "prompt": "极简奶油色包装盒,柔和自然光,产品摄影,干净背景",
  "n": 1,
  "size": "1024x1024",
  "quality": "high",
  "background": "auto",
  "output_format": "png",
  "moderation": "auto"
}

Images Edits

POST /v1/images/edits

请求参数

  • image(file | file[] | string | object,必填) 待编辑的输入图像。multipart 常用 image[]=@file.png;也可传 file_id / image_url 对象。GPT image 最多 16 张。
  • prompt(string,必填) 期望的编辑结果描述。说明要保留什么、改什么。GPT image 最长约 32000 字符。
  • model(string,选填) 图像模型。推荐 gpt-image-2;也可使用 gpt-image-1 / gpt-image-1-mini 等。
  • mask(file | string | object,选填) 可选遮罩图。透明区域表示需要重绘的部分;需与主图尺寸一致。
  • n(number,选填) 生成数量,范围 1–10,默认 1。
  • size(string,选填) 输出尺寸:auto | 1024x1024 | 1536x1024 | 1024x1536(GPT image)。默认 auto。
  • quality(string,选填) 画质:low | medium | high | auto(默认 auto)。
  • background(string,选填) 背景:transparent | opaque | auto。transparent 时建议 output_format 为 png/webp。
  • input_fidelity(string,选填) 输入图保真度:high | low。high 更严格保留人脸/Logo 等细节,消耗更多 input tokens。
  • output_format(string,选填) 输出格式:png | jpeg | webp。
  • output_compression(number,选填) 压缩率 0–100,仅 webp/jpeg 生效。
  • moderation(string,选填) 内容审核强度:low | auto(默认 auto)。
  • stream(boolean,选填) 是否流式返回。
  • partial_images(number,选填) 流式部分图数量 0–3。
  • user(string,选填) 终端用户标识,便于滥用监测。

请求示例

{
  "model": "gpt-image-2",
  "prompt": "把背景换成浅灰摄影棚,保留主体包装盒与标签文字,柔和侧光",
  "image": [
    {
      "image_url": "https://example.com/product-source.png"
    }
  ],
  "n": 1,
  "size": "1024x1024",
  "quality": "high",
  "input_fidelity": "high",
  "background": "opaque",
  "output_format": "png"
}

查看接口文档 · 查看当前可用模型和价格