PixMind Docs
API 参考图片模型FLUX.1 Kontext Pro

FLUX.1 Kontext Pro 图片生成

使用 FLUX.1 Kontext Pro 生成和编辑具备上下文理解的图片。

具备上下文理解的图片生成与编辑,在修改时保持主体和视觉风格。

提供方

Black Forest Labs

模型 ID

flux-kontext-pro

请求端点

POST /v1/generations

模型说明

  • 执行编辑任务时,请至少传入一张 reference_images。

请求参数

参数类型必填说明
modelstring

稳定的 PixMind 模型 ID,请使用 `flux-kontext-pro`。

可选值: flux-kontext-pro

promptstring

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

aspect_ratiostring

期望输出画面比例。

可选值: 1:1, 16:9, 9:16, 4:3, 3:4

默认值: 1:1

reference_imagesstring[] (URI)

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

callback_urlstring (URI)

接收任务终态事件的 HTTPS 地址;不填写时仍可使用轮询。

请求示例

cURL
curl https://aihub-admin.aimix.pro/v1/generations \
  -H "Authorization: Bearer $PIXMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "flux-kontext-pro",
  "prompt": "Replace the background with a warm modern kitchen while keeping the product unchanged",
  "aspect_ratio": "4:3",
  "reference_images": [
    "https://example.com/source.jpg"
  ]
}'
JavaScript
const response = await fetch("https://aihub-admin.aimix.pro/v1/generations", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.PIXMIND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "flux-kontext-pro",
  "prompt": "Replace the background with a warm modern kitchen while keeping the product unchanged",
  "aspect_ratio": "4:3",
  "reference_images": [
    "https://example.com/source.jpg"
  ]
})
});

const task = await response.json();

任务受理响应

生成任务为异步处理。请保存响应中的 id,并轮询 GET /v1/generations/{id},直到任务进入终态。

202 Accepted
{
  "id": "img_01JXYZ...",
  "model": "flux-kontext-pro",
  "status": "processing"
}

API 定价

配置价格
默认生成或编辑$0.040 / image

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