| 项目 | 说明 |
|---|---|
| 模型 ID | gpt-image-2 |
| 能力 | 文生图、图片编辑 |
| 接口 | POST /v1/images/generations |
参数
| 参数 | 类型 | 必填 | 可选值 | 默认值 | 说明 |
|---|---|---|---|---|---|
model | string | 是 | gpt-image-2 | — | 模型 ID |
prompt | string | 是 | 1 到 32000 个字符 | — | 生图提示词 |
image | string[] | 否 | 最多 8 张 | — | 待编辑图片的 base64,必须带 data URL 前缀,如 data:image/png;base64,,单张解码后不超过 20MB。不为空时为图片编辑 |
resolution | string | 是 | auto、1K | — | 输出分辨率档位 |
ratio | string | 是 | auto、1:1、3:4、4:3、16:9、9:16、2:3、3:2、21:9 | — | 输出宽高比 |
quality | string | 否 | auto、low、medium、high | auto | 输出质量 |
output_format | string | 否 | png、jpeg、webp | png | 输出格式 |
background | string | 否 | auto、opaque、transparent | auto | 背景模式 |
组合限制
resolution与ratio要么都是auto,要么都不是。resolution=1K时必须指定具体比例。background=transparent时,output_format只能是png或webp。
请求示例
curl https://openapi.mindsee.app/v1/images/generations \
--max-time 330 \
-H "Authorization: Bearer $MINDSEE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "一只橘猫坐在窗台上看雨,水彩风格",
"resolution": "1K",
"ratio": "3:4",
"quality": "high"
}'
curl https://openapi.mindsee.app/v1/images/generations \
--max-time 330 \
-H "Authorization: Bearer $MINDSEE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "一个扁平风格的咖啡杯图标",
"resolution": "1K",
"ratio": "1:1",
"background": "transparent",
"output_format": "png"
}'
jq -n --rawfile image <(base64 < input.png | tr -d '\n') '{
"model": "gpt-image-2",
"prompt": "把背景换成海边日落",
"image": ["data:image/png;base64," + $image],
"resolution": "auto",
"ratio": "auto"
}' | curl https://openapi.mindsee.app/v1/images/generations \
--max-time 330 \
-H "Authorization: Bearer $MINDSEE_API_KEY" \
-H "Content-Type: application/json" \
-d @-
响应示例
{
"created": 1767225600,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
]
}
