跳至正文
EN

GPT Image 2.6 API 接入文档

使用 VezAPI 密钥接入 GPT Image 2.6。下列操作共用同一个账号余额和鉴权方式。

Flare 和 Sunburst 当前仅开放文本生成位图(PNG、JPEG、WebP 或 GIF)。图片编辑和 SVG 输出缺少可执行的用量上限,暂不接入;Economy 保留固定价格操作。

服务地址: https://api.vezapi.com
请求头使用 Authorization: Bearer YOUR_VEZAPI_KEY。每次提交使用唯一的 Idempotency-Key,查询同一笔提交时才复用。

GPT Image 2.6 Economy 图生图

POST/api/v1/jobs/createTask

模型标识: gpt-image-2-6/economy-image-to-image

参数类型说明与限制
model
必填
string

The model name used for generation. This endpoint must use `gpt-image-2-6/economy-image-to-image`.

可选值:"gpt-image-2-6/economy-image-to-image"

默认:"gpt-image-2-6/economy-image-to-image"

callBackUrl
可选
string

任务完成通知的回调地址。可选参数。如果提供,任务完成时(无论成功还是失败)系统都会向该地址发送 POST 请求;不提供则不发送回调通知。

input
必填
object

图生图任务的输入参数。

input.prompt
必填
string

如何编辑或组合输入图的指令。写清哪些保持不变、哪些需要修改;需要出现在图里的文字请用引号括起来。必填,1~20,000 个字符。

minLength: 1

maxLength: 20000

input.input_urls
可选
array

要编辑或作为参考的图片 URL,须可公网访问。最多 16 张,支持 JPEG、PNG、WebP(含 jpg),单张不超过 30 MB。非必填。传多张时可在提示词里按顺序指代。

maxItems: 16

input.aspect_ratio
可选
string

输出图像的宽高比。`auto`(默认)由模型根据提示词和输入图选择最合适的画幅。Economy 仅支持 `auto`, `1:1`, `16:9`, `9:16`, `3:2`, `2:3`, `21:9`, `4:3`。

可选值:"auto", "1:1", "16:9", "9:16", "3:2", "2:3", "21:9", "4:3"

默认:"auto"

input.background
可选
string

背景处理方式。 - `transparent`:透明背景,适合产品抠图、图标、贴纸 - `opaque`:始终为不透明背景 - `auto`(默认):由模型决定

可选值:"transparent", "opaque", "auto"

默认:"auto"

input.output_format
可选
string

输出图像格式。默认 `png`。Economy 仅支持 `png` 。

可选值:"png"

默认:"png"

请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gpt-image-2-6/economy-image-to-image",
  "input": {
    "prompt": "Keep the shelf, the mug shapes, the window light and the camera angle unchanged. Change the glaze of every mug to matte black, and add a small chalkboard sign on the top shelf that reads \"FRESH ROAST\" in white chalk lettering.",
    "aspect_ratio": "auto"
  }
}'
返回值与错误

HTTP 200

请求成功

参数类型说明与限制
code
可选
integer

响应状态码 - **200**: 成功 - 请求已处理完成 - **401**: 未授权 - 身份验证凭据缺失或无效 - **402**: 积分不足 - 账户余额不足以执行该操作 - **404**: 未找到 - 请求的资源或接口不存在 - **422**: 参数验证错误 - 请求参数未通过校验 - **429**: 调用频率超限 - 已超出该资源的请求限制 - **433**: 子密钥使用超限 - **455**: 服务不可用 - 系统正在维护中 - **500**: 服务器内部错误 - 处理请求时发生意外故障 - **501**: 生成失败 - 内容生成任务执行失败 - **505**: 功能禁用 - 当前请求的功能已被禁用

可选值:200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
可选
string

响应消息,请求失败时返回错误描述

data
必填
object
data.taskId
必填
string

任务 ID,可结合「获取任务详情」接口查询任务状态

GPT Image 2.6 Economy 文生图

POST/api/v1/jobs/createTask

模型标识: gpt-image-2-6/economy-text-to-image

参数类型说明与限制
model
必填
string

The model name used for generation. This endpoint must use `gpt-image-2-6/economy-text-to-image`.

可选值:"gpt-image-2-6/economy-text-to-image"

默认:"gpt-image-2-6/economy-text-to-image"

callBackUrl
可选
string

任务完成通知的回调地址。可选参数。如果提供,任务完成时(无论成功还是失败)系统都会向该地址发送 POST 请求;不提供则不发送回调通知。

input
必填
object

文生图任务的输入参数。

input.prompt
必填
string

要生成的图像的文字描述。建议写清主体、场景、构图、光线和风格;需要出现在图里的文字请用引号括起来。必填,1~20,000 个字符。

minLength: 1

maxLength: 20000

input.aspect_ratio
可选
string

输出图像的宽高比。`auto`(默认)由模型根据提示词选择最合适的画幅。Economy 仅支持 `auto`, `1:1`, `16:9`, `9:16`, `3:2`, `2:3`, `21:9`, `4:3`。

可选值:"auto", "1:1", "16:9", "9:16", "3:2", "2:3", "21:9", "4:3"

默认:"auto"

input.background
可选
string

背景处理方式。 - `transparent`:透明背景,适合产品抠图、图标、贴纸 - `opaque`:始终为不透明背景 - `auto`(默认):由模型决定

可选值:"transparent", "opaque", "auto"

默认:"auto"

input.output_format
可选
string

输出图像格式。默认 `png`。Economy 仅支持 `png` 和 `gif`。

可选值:"png", "gif"

默认:"png"

input.frame_count
可选
string

帧数。`auto`(默认)由模型决定。可选值:`auto`、`4`、`9`、`16`、`25`、`36`、`64`。只有输出格式为gif时候支持此参数。

可选值:"auto", "4", "9", "16", "25", "36", "64"

默认:"auto"

input.frame_duration_ms
可选
number

每帧时长,单位毫秒。`auto`(默认)由模型决定。也可传入 20~2000 之间的任意整数,系统会按 10ms 取整。只有输出格式为gif时候支持此参数。

请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gpt-image-2-6/economy-text-to-image",
  "input": {
    "prompt": "A sunlit ceramic studio shelf lined with hand-thrown mugs in muted terracotta and sage glazes, soft morning light through a side window, shallow depth of field, clean editorial product photography, with a small paper tag on the middle shelf that reads \"BATCH 07\".",
    "aspect_ratio": "auto"
  }
}'
返回值与错误

HTTP 200

请求成功

参数类型说明与限制
code
可选
integer

响应状态码 - **200**: 成功 - 请求已处理完成 - **401**: 未授权 - 身份验证凭据缺失或无效 - **402**: 积分不足 - 账户余额不足以执行该操作 - **404**: 未找到 - 请求的资源或接口不存在 - **422**: 参数验证错误 - 请求参数未通过校验 - **429**: 调用频率超限 - 已超出该资源的请求限制 - **433**: 子密钥使用超限 - **455**: 服务不可用 - 系统正在维护中 - **500**: 服务器内部错误 - 处理请求时发生意外故障 - **501**: 生成失败 - 内容生成任务执行失败 - **505**: 功能禁用 - 当前请求的功能已被禁用

可选值:200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
可选
string

响应消息,请求失败时返回错误描述

data
必填
object
data.taskId
必填
string

任务 ID,可结合「获取任务详情」接口查询任务状态

GPT Image 2.6 Flare 文生图

POST/api/v1/jobs/createTask

模型标识: gpt-image-2-6/flare-text-to-image

参数类型说明与限制
model
必填
string

用于生成的模型名称。该接口必须使用 `gpt-image-2-6/flare-text-to-image`。

可选值:"gpt-image-2-6/flare-text-to-image"

默认:"gpt-image-2-6/flare-text-to-image"

callBackUrl
可选
string

任务完成通知的回调地址。可选参数。如果提供,任务完成时(无论成功还是失败)系统都会向该地址发送 POST 请求;不提供则不发送回调通知。

input
必填
object

输入参数。

input.prompt
必填
string

生成描述。建议写清主体、场景、构图、光线和风格;需要出现在图里的文字请用引号括起来。必填,1~32,000 个字符。

minLength: 1

maxLength: 32000

input.aspect_ratio
可选
string

画面比例,可选,默认 `auto`。 可选值:`auto`、`1:1`、`3:2`、`2:3`、`4:3`、`3:4`、`5:4`、`4:5`、`16:9`、`9:16`、`2:1`、`1:2`、`21:9`、`9:21`、`3:1`、`1:3`。

可选值:"auto", "1:1", "3:2", "2:3", "4:3", "3:4", "5:4", "4:5", "16:9", "9:16", "2:1", "1:2", "21:9", "9:21", "3:1", "1:3"

默认:"auto"

input.resolution
可选
string

分辨率档,可选,默认 `1K`。 GIF 的帧像素**不走**这张表,请用 `size`。 静态图像素对照(宽×高): | 比例 | 1K | 2K | 4K | |---|---|---|---| | 1:1 / auto | 1024×1024 | 2048×2048 | 2880×2880 | | 3:2 | 1536×1024 | 2048×1360 | 3520×2336 | | 2:3 | 1024×1536 | 1360×2048 | 2336×3520 | | 4:3 | 1024×768 | 2048×1536 | 3312×2480 | | 3:4 | 768×1024 | 1536×2048 | 2480×3312 | | 5:4 | 1280×1024 | 2560×2048 | 3216×2576 | | 4:5 | 1024×1280 | 2048×2560 | 2576×3216 | | 16:9 | 1536×864 | 2048×1152 | 3840×2160 | | 9:16 | 864×1536 | 1152×2048 | 2160×3840 | | 2:1 | 2048×1024 | 2688×1344 | 3840×1920 | | 1:2 | 1024×2048 | 1344×2688 | 1920×3840 | | 21:9 | 2016×864 | 2688×1152 | 3840×1648 | | 9:21 | 864×2016 | 1152×2688 | 1648×3840 | | 3:1 | 1536×512 | 3072×1024 | 3840×1280 | | 1:3 | 512×1536 | 1024×3072 | 1280×3840 |

可选值:"1K", "2K", "4K"

默认:"1K"

input.quality
可选
string

画质,可选,默认 `medium`。 可选值:`low`、`medium`、`high`、`xhigh`、`max`、`auto`。

可选值:"low", "medium", "high", "xhigh", "max", "auto"

默认:"medium"

input.background
可选
string

背景,可选,默认 `auto`。透明背景只支持 `png` / `webp`/ `gif`。 - `transparent`:透明背景,适合产品抠图、图标、贴纸。`output_format` 必须是 `png` 或 `webp` - `opaque`:始终实色背景 - `auto`(默认):由模型决定

可选值:"transparent", "opaque", "auto"

默认:"auto"

input.output_format
可选
string

输出格式,可选,默认 `png`。传入 `jpg` 会按 `jpeg` 处理。 - 透明背景只支持 `png` / `webp`

可选值:"png", "jpeg", "webp", "gif"

默认:"png"

input.complexity
可选
string

规划复杂度,可选,默认 `high`。 可选值:`low`、`medium`、`high`。

可选值:"low", "medium", "high"

默认:"high"

input.moderation
可选
string

审核强度,可选,默认 `low`。 可选值:`auto`、`low`。

可选值:"auto", "low"

默认:"low"

input.output_compression
可选
integer

jpeg / webp 压缩率,可选,范围 0–100。 仅 `output_format` 为 `jpeg` 或 `webp` 时提交;其它格式不要带这个字段。

minimum: 0

maximum: 100

input.size
可选
string

GIF **单帧**像素尺寸,仅 `output_format=gif` 时提交。宽、高均为 16 的倍数。可选,默认 `auto`(当前等同 `512x512`)。不能传 `1:1` 等比例名。非 gif 不要带。 上游先将帧排入一张拼图:2–8 帧使用 4×2,9 帧使用 3×3,10–12 帧使用 4×3,13–16 帧使用 4×4;行列可互换,取更接近方形的布局。整张拼图必须满足单边不超过 3840、总像素不超过 8,294,400、长短边之比不超过 3:1,否则提交返回 400。 - `512x512` 可用于全部 2–16 帧 - `768x768` 最多 12 帧 - `1024x1024` 即使只有 2 帧也会超出拼图单边上限

默认:"auto"

input.frame_count
可选
integer

GIF 帧数,仅 `output_format=gif` 时提交。整数 2–16,默认 9。非 gif 不要带。

默认:9

minimum: 2

maximum: 16

input.frame_duration_ms
可选
integer

GIF 每帧时长,仅 `output_format=gif` 时提交。整数毫秒,默认 200,最小 20,按 10 ms 取整。非 gif 不要带。

默认:200

minimum: 20

maximum: 2000

请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gpt-image-2-6/flare-text-to-image",
  "input": {
    "prompt": "A cinematic product photo of a red maple leaf on dark stone, soft side light, shallow depth of field, with a small paper tag that reads \"BATCH 07\".",
    "aspect_ratio": "auto",
    "resolution": "1K"
  }
}'
返回值与错误

HTTP 200

请求成功

参数类型说明与限制
code
可选
integer

响应状态码 - **200**: 成功 - 请求已处理完成 - **401**: 未授权 - 身份验证凭据缺失或无效 - **402**: 积分不足 - 账户余额不足以执行该操作 - **404**: 未找到 - 请求的资源或接口不存在 - **422**: 参数验证错误 - 请求参数未通过校验 - **429**: 调用频率超限 - 已超出该资源的请求限制 - **433**: 子密钥使用超限 - **455**: 服务不可用 - 系统正在维护中 - **500**: 服务器内部错误 - 处理请求时发生意外故障 - **501**: 生成失败 - 内容生成任务执行失败 - **505**: 功能禁用 - 当前请求的功能已被禁用

可选值:200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
可选
string

响应消息,请求失败时返回错误描述

data
必填
object
data.taskId
必填
string

任务 ID,可结合「获取任务详情」接口查询任务状态

GPT Image 2.6 Sunburst 文生图

POST/api/v1/jobs/createTask

模型标识: gpt-image-2-6/sunburst-text-to-image

参数类型说明与限制
model
必填
string

用于生成的模型名称。该接口必须使用 `gpt-image-2-6/sunburst-text-to-image`。

可选值:"gpt-image-2-6/sunburst-text-to-image"

默认:"gpt-image-2-6/sunburst-text-to-image"

callBackUrl
可选
string

任务完成通知的回调地址。可选参数。如果提供,任务完成时(无论成功还是失败)系统都会向该地址发送 POST 请求;不提供则不发送回调通知。

input
必填
object

输入参数。

input.prompt
必填
string

生成描述。建议写清主体、场景、构图、光线和风格;需要出现在图里的文字请用引号括起来。必填,1~32,000 个字符。

minLength: 1

maxLength: 32000

input.aspect_ratio
可选
string

画面比例,可选,默认 `auto`。 可选值:`auto`、`1:1`、`3:2`、`2:3`、`4:3`、`3:4`、`5:4`、`4:5`、`16:9`、`9:16`、`2:1`、`1:2`、`21:9`、`9:21`、`3:1`、`1:3`。

可选值:"auto", "1:1", "3:2", "2:3", "4:3", "3:4", "5:4", "4:5", "16:9", "9:16", "2:1", "1:2", "21:9", "9:21", "3:1", "1:3"

默认:"auto"

input.resolution
可选
string

分辨率档,可选,默认 `1K`。 GIF 的帧像素**不走**这张表,请用 `size`。 静态图像素对照(宽×高): | 比例 | 1K | 2K | 4K | |---|---|---|---| | 1:1 / auto | 1024×1024 | 2048×2048 | 2880×2880 | | 3:2 | 1536×1024 | 2048×1360 | 3520×2336 | | 2:3 | 1024×1536 | 1360×2048 | 2336×3520 | | 4:3 | 1024×768 | 2048×1536 | 3312×2480 | | 3:4 | 768×1024 | 1536×2048 | 2480×3312 | | 5:4 | 1280×1024 | 2560×2048 | 3216×2576 | | 4:5 | 1024×1280 | 2048×2560 | 2576×3216 | | 16:9 | 1536×864 | 2048×1152 | 3840×2160 | | 9:16 | 864×1536 | 1152×2048 | 2160×3840 | | 2:1 | 2048×1024 | 2688×1344 | 3840×1920 | | 1:2 | 1024×2048 | 1344×2688 | 1920×3840 | | 21:9 | 2016×864 | 2688×1152 | 3840×1648 | | 9:21 | 864×2016 | 1152×2688 | 1648×3840 | | 3:1 | 1536×512 | 3072×1024 | 3840×1280 | | 1:3 | 512×1536 | 1024×3072 | 1280×3840 |

可选值:"1K", "2K", "4K"

默认:"1K"

input.quality
可选
string

画质,可选,默认 `medium`。 可选值:`low`、`medium`、`high`、`xhigh`、`max`、`auto`。

可选值:"low", "medium", "high", "xhigh", "max", "auto"

默认:"medium"

input.background
可选
string

背景,可选,默认 `auto`。透明背景只支持 `png` / `webp`/ `gif`。 - `transparent`:透明背景,适合产品抠图、图标、贴纸。`output_format` 必须是 `png` 或 `webp` - `opaque`:始终实色背景 - `auto`(默认):由模型决定

可选值:"transparent", "opaque", "auto"

默认:"auto"

input.output_format
可选
string

输出格式,可选,默认 `png`。传入 `jpg` 会按 `jpeg` 处理。 - 透明背景只支持 `png` / `webp`

可选值:"png", "jpeg", "webp", "gif"

默认:"png"

input.complexity
可选
string

规划复杂度,可选,默认 `high`。 可选值:`low`、`medium`、`high`。

可选值:"low", "medium", "high"

默认:"high"

input.moderation
可选
string

审核强度,可选,默认 `low`。 可选值:`auto`、`low`。

可选值:"auto", "low"

默认:"low"

input.output_compression
可选
integer

jpeg / webp 压缩率,可选,范围 0–100。 仅 `output_format` 为 `jpeg` 或 `webp` 时提交;其它格式不要带这个字段。

minimum: 0

maximum: 100

input.size
可选
string

GIF **单帧**像素尺寸,仅 `output_format=gif` 时提交。宽、高均为 16 的倍数。可选,默认 `auto`(当前等同 `512x512`)。不能传 `1:1` 等比例名。非 gif 不要带。 上游先将帧排入一张拼图:2–8 帧使用 4×2,9 帧使用 3×3,10–12 帧使用 4×3,13–16 帧使用 4×4;行列可互换,取更接近方形的布局。整张拼图必须满足单边不超过 3840、总像素不超过 8,294,400、长短边之比不超过 3:1,否则提交返回 400。 - `512x512` 可用于全部 2–16 帧 - `768x768` 最多 12 帧 - `1024x1024` 即使只有 2 帧也会超出拼图单边上限

默认:"auto"

input.frame_count
可选
integer

GIF 帧数,仅 `output_format=gif` 时提交。整数 2–16,默认 9。非 gif 不要带。

默认:9

minimum: 2

maximum: 16

input.frame_duration_ms
可选
integer

GIF 每帧时长,仅 `output_format=gif` 时提交。整数毫秒,默认 200,最小 20,按 10 ms 取整。非 gif 不要带。

默认:200

minimum: 20

maximum: 2000

请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gpt-image-2-6/sunburst-text-to-image",
  "input": {
    "prompt": "A cinematic product photo of a red maple leaf on dark stone, soft side light, shallow depth of field, with a small paper tag that reads \"BATCH 07\".",
    "aspect_ratio": "auto",
    "resolution": "1K"
  }
}'
返回值与错误

HTTP 200

请求成功

参数类型说明与限制
code
可选
integer

响应状态码 - **200**: 成功 - 请求已处理完成 - **401**: 未授权 - 身份验证凭据缺失或无效 - **402**: 积分不足 - 账户余额不足以执行该操作 - **404**: 未找到 - 请求的资源或接口不存在 - **422**: 参数验证错误 - 请求参数未通过校验 - **429**: 调用频率超限 - 已超出该资源的请求限制 - **433**: 子密钥使用超限 - **455**: 服务不可用 - 系统正在维护中 - **500**: 服务器内部错误 - 处理请求时发生意外故障 - **501**: 生成失败 - 内容生成任务执行失败 - **505**: 功能禁用 - 当前请求的功能已被禁用

可选值:200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
可选
string

响应消息,请求失败时返回错误描述

data
必填
object
data.taskId
必填
string

任务 ID,可结合「获取任务详情」接口查询任务状态

任务状态与回调

异步任务请保存返回的 taskId。调用 GET /api/v1/jobs/recordInfo?taskId=... 查询,或在创建时设置 callBackUrl。只有任务所属账号可以查询任务或基于任务创建派生资源。

超时可能表示请求已经受理。请在控制台查看原请求,不要自动新建任务。回调可能重试并重复到达,请使用 X-VezAPI-Event-Id 去重。

文件、日志与计费

生成媒体通常随上游保留 14 天,上传文件在 24 小时后失效。请在过期前保存所需文件。VezAPI 仅流式转发已登记资源,不提供永久作品库。请求日志保留两个自然月。

调用前预留积分,最终按实际优惠扣分 1:1 结算。用量不明时暂停新付费请求。若保护其他任务预留后余额不足以结算,会保留待结算记录,补足余额后再扣费;模型用量不会将钱包扣成负数。按时长计价的输入文件由服务端读取时长,读取失败时不提交模型任务。