APIMODELSAPIMODELS
Docs/GPT Image 2 Lite API

GPT Image 2 Lite API

平台上价格最低的 GPT Image 2 通道,单档一口价 $0.01/张,实际输出约 1.5MP 并跟随你的宽高比(比名义 1K 更大);2K/4K 已于 2026-08-31 下架,需要请用 gpt-image-2。同一端点自动路由文生图 / 图生图(参考图 + 多图融合),同步返回,无需轮询。

认证

Authorization: Bearer YOUR_API_KEY

模型与价格

模型model价格说明
GPT Image 2 Litegpt-image-2-lite$0.01 /张(约 1.5MP)同步 · 单档 ~1.5MP · 文生图 + 图生图

代码示例

POST/api/v1/images/generations
# ─── 1. Text-to-image ──────────────────────────────────────
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-lite",
    "prompt": "A children'"'"'s book drawing of a veterinarian using a stethoscope to listen to the heartbeat of a baby otter.",
    "aspect_ratio": "1:1",
    "resolution": "2K"
  }'

# Response (sync — image URL returned directly):
# { "code": 200, "msg": "success", "data": { "taskId": "clxxx", "state": "completed", "resultUrls": ["https://r2.apimodels.app/..."] } }


# ─── 2. Image editing with a reference URL ────────────────
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-lite",
    "prompt": "Change the season to winter with snow",
    "image_url": "https://example.com/landscape.jpg"
  }'


# ─── 3. Multi-image fusion via base64 ─────────────────────
curl -X POST https://api.apimodels.app/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2-lite",
    "prompt": "Combine the model from image 1 with the outfit from image 2",
    "image_base64": "BASE64_IMAGE_1",
    "image_urls": ["https://example.com/outfit.jpg"]
  }'


# ─── 4. Poll status (lite is sync, this returns completed) ─
curl "https://api.apimodels.app/v1/images/generations?task_id=TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

请求参数

字段必填类型说明
model是string必须为 "gpt-image-2-lite"
prompt是string图片描述或编辑指令。多图编辑可用 "image 1"、"image 2" 引用具体参考图
aspect_ratio否string"auto"(默认)或 W:H 枚举,如 1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 3:2 / 2:3 / 21:9。⚠️ auto 的真实行为:**图生图**跟随参考图比例;**文生图**没有可跟随的输入,会退回 1:1 方图——不是"让模型自决"。要指定形状请直接选枚举值。另外两点实测(2026-08-13):在提示词里写比例**无效**(不传 size 只在提示词里写 5:2,仍回 1024×1024);传枚举以外的精确 size 会被上游**吸附到最近的网格**(传 5:2 的 1600×640 与传 21:9 的 1552×656 拿回的都是 1456×624)。所以当前最宽只能到 21:9(2.33)。
resolution否string可省略(单档 1K)。传 "2K"/"4K" 会返回 400 —— 两档已于 2026-08-31 下架,请用 gpt-image-2。
image_url否string单张参考图 URL,传入则走图生图
image_urls否string[]多张参考图 URL,用于多图融合
image_base64否stringBase64 或 data URI 参考图(本地文件用)
image_mime_type否stringimage_base64 对应的 MIME,默认 image/png
output_format否string交付格式:"png" / "jpeg" / "webp"。省略时:不透明图交付 JPEG q95、带透明通道的图保持 PNG。传 "png" 得到无损原图(不做任何重编码),体积约为 JPEG 的 6 倍;"webp" 体积与 JPEG 相当且保留透明通道。
n否integer生成数量 1-10(默认 1),按张数线性扣费
callback_url否string任务完成后的回调 URL

响应字段

字段必填类型说明
code—integer200 表示成功;其他见错误码表
data.taskId—string任务 ID
data.state—stringcompleted / failed(同步,创建后状态通常已是 completed)
data.resultUrls—string[]R2 托管的图片 URL
data.failMsg—string失败原因(state=failed 时)
data.costTime—integer耗时(ms)

说明

  • 同步模型:POST 创建任务时通常已经返回 completed 与 resultUrls,无需额外轮询;但仍可走 GET ?task_id= 兼容,响应结构一致。
  • 端点自动路由:只传 prompt → 文生图;携带 image_url / image_urls / image_base64 → 图生图。
  • 单档一口价 $0.01/张,与比例、参考图数量无关;实际输出约 1.5MP 且跟随宽高比。这是平台上 GPT Image 2 系列的最低价;要 2K/4K 用 gpt-image-2。
  • lite 忽略 quality 参数:传了不报错、不生效、也不影响计费。需要控制 quality(medium/high)请改用 gpt-image-2 或 gpt-image-2-all。
  • 典型耗时 20-45 秒(4K 端更久);同步调用请把客户端超时设为 ≥90 秒。
  • 失败不扣费:state=failed 的任务不计入账单,可安全重试

相关:异步任务式契约与更多比例枚举见 GPT Image 2;试一试:Playground

常见问题

GPT Image 2 Lite 多少钱?

一口价 $0.01/张(单档),实际输出约 1.5MP、贴合宽高比(2K/4K 已于 2026-08-31 下架),与比例、参考图数量无关,是 apimodels.app 上 GPT Image 2 系列的最低价。失败不扣费。

GPT Image 2 Lite 支持 2K/4K 吗?

不支持 —— 2026-08-31 起 lite 只有单档(实际约 1.5MP、贴比例,比名义 1K 还大);传 "2K"/"4K" 会返回 400。要原生 2K/4K 请用 gpt-image-2。

GPT Image 2 Lite 出图要多久?必须轮询吗?

出图中位约 41 秒,是 gpt-image-2 家族里最快的一档。POST 创建会立刻返回 taskId 和 state=pending,所以默认是建任务 + 轮询(或用 callback_url)。想一次调用直接拿图,就传 OpenAI 风格的 size(如 1024x1024)且不带 callback_url。