PixMind Docs
API 参考图片模型GPT Image 2

GPT Image 2 图片生成

使用 GPT Image 2 的质量与分辨率参数生成和编辑图片。

提供高可控图片生成与编辑,并可独立设置质量和分辨率。

提供方

OpenAI

模型 ID

gpt-image-2

请求端点

POST /api-platform/v1/generations

模型说明

  • quality 与 size 会共同参与计费。

请求参数

参数类型必填说明
modelstring

稳定的 PixMind 模型 ID,请使用 `gpt-image-2`。

可选值: gpt-image-2

promptstring

用于生成或编辑的自然语言指令。

qualitystring

生成质量档位。

可选值: low, medium, high

默认值: medium

resolutionstring

输出分辨率档位,该字段会影响请求价格。

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

默认值: 2K

aspectRatiostring

期望输出画面比例。

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

默认值: auto

referenceImagesstring[] (URI)

用于编辑、构图、主体或风格引导的参考图片 URL 数组。

请求示例

cURL
curl https://aihub-admin.aimix.pro/api-platform/v1/generations \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-image-2",
  "prompt": "Create a premium skincare campaign image and preserve the supplied package design",
  "quality": "medium",
  "resolution": "2K",
  "aspectRatio": "1:1",
  "referenceImages": [
    "https://example.com/package.png"
  ]
}'
JavaScript
const response = await fetch("https://aihub-admin.aimix.pro/api-platform/v1/generations", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.PIXMIND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-image-2",
  "prompt": "Create a premium skincare campaign image and preserve the supplied package design",
  "quality": "medium",
  "resolution": "2K",
  "aspectRatio": "1:1",
  "referenceImages": [
    "https://example.com/package.png"
  ]
})
});

const task = await response.json();

任务受理响应

生成任务为异步处理。请保存 taskId,并轮询 GET /api-platform/v1/tasks/{taskId},直到状态为 ready 或 failed。

200 OK
{
  "code": 1000,
  "data": {
    "id": "img_44160",
    "taskId": 44160,
    "type": "image",
    "model": "gpt-image-2",
    "status": "processing"
  }
}

API 定价

配置价格
Low · 1K / 2K / 4K$0.050 / $0.060 / $0.090
Medium · 1K / 2K / 4K$0.070 / $0.130 / $0.260
High · 1K / 2K / 4K$0.260 / $0.430 / $0.510

API 使用 apiPlatform 角色独立计费,与 PixMind Studio 积分分开;任务受理响应中的价格快照是最终计费依据。