GPT 图片模型

以 Markdown 格式查看

GPT 图片模型使用图片生成端点。

curl https://api.getopenmodels.com/v1/images \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OM_API_KEY" \
-d '{
"model": "gpt-image-2",
"route": { "provider": "<provider-for-this-model>" },
"route_mode": "balanced",
"prompt": "An elegant commercial product photograph: a transparent modern glass tumbler filled with ice cubes and lemon slices, with a bold, clearly printed label reading \"PURE FRESH\" on the glass. The background is a clean light-blue gradient with professional studio lighting.",
"n": 1,
"size": "1024x1024",
"quality": "low"
}'

对于 GPT 图片模型,请在请求体顶层字段中设置图片生成选项。示例中的 routeroute_mode 字段是 OpenModels 路由选项;移除它们即可使用默认可用路由。

字段类型备注
promptstring必填,描述期望图片的文本说明。
ninteger要生成的图片数量。有效范围:1-10
sizestring输出图片大小。常用值:auto1024x10241536x10241024x1536。当两条边都是 16 的倍数、宽高比在 1:33:1 之间,并且图片保持在当前像素和边长限制内时,gpt-image-2 也接受自定义 WIDTHxHEIGHT 值。
qualitystring渲染质量。有效值:autolowmediumhigh。快速草稿使用 low,最终素材使用 mediumhigh
output_formatstring图片格式。有效值:pngjpegwebp。默认值:png
output_compressioninteger0100 的压缩等级。仅当 output_formatjpegwebp 时适用。
backgroundstring背景处理。使用 autoopaquegpt-image-2 不支持透明背景。
moderationstring内容审核严格程度。有效值:autolow。默认值:auto