GPT Image 2 API

GPT Image 2 的 Buble API 参数、mode、价格与调用示例。

GPT Image 2 API

GPT Image 2 适合复杂指令跟随的图片生成与图像编辑工作流,并支持更长 prompt。

模型 key

  • openai/gpt-image-2 — GPT Image 2

支持的 mode 与输入

模型Mode名称输入要求
openai/gpt-image-2text_to_image文生图Prompt max 20000 chars
openai/gpt-image-2image_to_image图生图Prompt max 20000 chars
Images reference: 1-16 files, 10 MB, formats jpg, png, webp

参数

模型参数默认值可选值适用 mode
openai/gpt-image-2resolution1K1K, 2K, 4K全部 mode
openai/gpt-image-2aspect_ratio16:9auto, 1:1, 16:9, 9:16, 4:3, 3:4全部 mode

价格

模型价格
openai/gpt-image-2每张图片 1 credit;参数倍率:resolution={"1K":1,"2K":1,"4K":2}

生产建议

  • 显式传入 mode
  • 只使用上表列出的参数值。
  • 媒体输入类 mode 请先用 POST /api/v1/files 上传素材。
  • 如果页面包含多个变体,请使用你真正需要的模型 key。

示例:文生图

curl https://buble.ai/api/v1/generations \
  -H "Authorization: Bearer $BUBLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-2",
    "mode": "text_to_image",
    "prompt": "A premium editorial product image of a minimalist ceramic coffee grinder on a warm walnut counter, soft studio lighting",
    "aspect_ratio": "16:9",
    "resolution": "1K"
  }'

示例:图生图

Upload an image first, then pass the returned URL to image_urls.

curl https://buble.ai/api/v1/generations \
  -H "Authorization: Bearer $BUBLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-image-2",
    "mode": "image_to_image",
    "prompt": "Transform the source into a clean commercial product image while preserving the main object",
    "image_urls": ["https://example.com/source.png"],
    "aspect_ratio": "16:9",
    "resolution": "1K"
  }'