跳到导航

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 图片模型,请在请求体顶层字段中设置图片生成选项。示例中的 route 和 route_mode 字段是 OpenModels 路由选项;移除它们即可使用默认可用路由。

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