图片
GPT Image
OpenAI 的 GPT Image 模型:细节清晰,文字渲染出色,编辑时支持最多 16 张图片。GPT Image 2 所有尺寸统一价格;Flare 和 Sunburst 按尺寸计费。
模型
GPT Image 2.5 Flare 主打速度;2.5 Sunburst 优先保证画质;GPT Image 2 继续保留,供已针对它调优的工作流使用。
生成图片
main.py
import osfrom openai import OpenAIclient = OpenAI(base_url="https://api.zurelay.com/v1", api_key=os.environ["ZURELAY_API_KEY"])result = client.images.generate( model="gpt-image-2.5-sunburst", prompt="An isometric illustration of a tiny bakery at night, warm window light, a cat on the awning", size="1536x1024", extra_body={ "quality": "high" },)print(result.data[0].url)参数
sizestring1024x1024, 1536x1024, 1024x1536, 2048x2048, 3840x2160, 2160x3840,或auto。GPT Image 2 所有尺寸统一价格。Flare 和 Sunburst 将不超过 1024x1024 的尺寸按 1K 计费,不超过 2560x1440 的按 2K 计费,更大的按 4K 计费;未指定尺寸或设为auto时,生成 1024x1024 图片。qualitystringlow、medium或high(默认)。所有级别价格相同。backgroundstringtransparent、opaque或auto。透明背景需要使用 PNG 或 WebP 输出。output_formatstringpng、jpeg或webp。ninteger- 1 到 4 张图片。
编辑时支持最多 16 张图片
通过 client.images.edit 上传一个或多个文件,或通过 JSON 传入 images。不支持蒙版;请用文字描述要修改的区域。
result = client.images.edit( model="gpt-image-2.5-flare", image=[open(f"tile-{i}.png", "rb") for i in range(1, 9)], prompt="Arrange the eight product photos into a clean 4 x 2 catalog grid on white.",)更多图片传入方式: 图片编辑与参考图。
有疑问,或发现内容缺失?联系我们的支持团队,我们会通过邮件回复,通常只需一分钟。