> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vidgo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# FLUX.2 Flex 图像编辑

> FLUX.2 Flex 图像编辑 API 用于改造图像或组合多张参考图，通过文字引导主体、风格和构图。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)接口获取结果。

使用 FLUX.2 Flex 改造图像或组合参考图，通过文字引导主体、风格和构图。

## 模型

* **blackforestlabs/flux-2-flex/edit** - 使用提示词和参考图编辑图像。

## 功能

* 使用提示词和参考图编辑图像。
* `image_urls` 接受 1-8 张图像。
* 可选 `1K`、`2K` 输出分辨率。

## 输出选项

### 图像尺寸

* `size`：必填。可选值：`1:1`、`4:3`、`3:4`、`16:9`、`9:16`、`3:2`、`2:3`、`auto`。`auto` 使用 `image_urls` 中第一张图像的宽高比。

### 分辨率

* `resolution`：必填。可选值：`1K`、`2K`。

## 高级参数

`model` 和可选的 `callback_url` 放在请求根级。所有工作流参数（包括输出选项）都放在 `input` 内。

发送本页列出的 input 字段。每个输入 URL 都是公开的 HTTP(S) URL。

### 提示词

* `prompt`：必填。描述要做的修改。长度：**3-5,000 个字符**。

### 图像 URL

* `image_urls`：必填。提供公开可访问的图像 URL。1-8 项。每项都必须是 HTTP(S) URL。

## 已验证示例

此示例通过 Vidgo API 生成，也是 Playground 中的默认示例。源图和结果图托管在 Vidgo CDN 上。

![参考图 1](https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-01.png)

![参考图 2](https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-02.png)

![参考图 3](https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-03.png)

![Pip 与玻璃花园](https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/output.jpg)

```json theme={null}
{
  "code": 200,
  "data": {
    "task_id": "E4MB5ERGH360DFJI",
    "status": "finished",
    "files": [
      {
        "file_type": "image",
        "file_url": "https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/output.jpg"
      }
    ],
    "created_time": "2026-09-26T11:07:59",
    "error_message": null,
    "progress": 100
  }
}
```


## OpenAPI

````yaml zh/api-manual/image-series/blackforestlabs-flux-2-flex-edit.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - FLUX.2 Flex 图像编辑
  description: 使用 FLUX.2 Flex 改造图像或组合参考图，通过文字引导主体、风格和构图。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Image Series
      summary: FLUX.2 Flex 图像编辑
      description: >-
        发送本工作流列出的字段。将 `prompt`、`image_urls`、`size` 和 `resolution` 放在 `input`
        内。每个 `image_urls` 项都是公开的 HTTP(S) URL。
      operationId: submit_blackforestlabs_flux_2_flex_edit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: true
              properties:
                model:
                  type: string
                  example: blackforestlabs/flux-2-flex/edit
                input:
                  type: object
                  required:
                    - image_urls
                    - prompt
                    - resolution
                    - size
                  properties:
                    prompt:
                      type: string
                      minLength: 3
                      maxLength: 5000
                      description: 编辑参考图的文字指令，3-5,000 个字符。
                    image_urls:
                      type: array
                      items:
                        type: string
                        format: uri
                        description: 公开的 HTTP(S) 图像 URL。
                      minItems: 1
                      maxItems: 8
                      description: 参考图，1-8 个公开的 HTTP(S) URL。
                    size:
                      type: string
                      enum:
                        - '1:1'
                        - '4:3'
                        - '3:4'
                        - '16:9'
                        - '9:16'
                        - '3:2'
                        - '2:3'
                        - auto
                      description: 输出图像的宽高比。`auto` 使用 `image_urls` 中第一张图像的宽高比。
                    resolution:
                      type: string
                      enum:
                        - 1K
                        - 2K
                      description: 输出图像分辨率。
                  additionalProperties: false
                callback_url:
                  type: string
                  nullable: true
                  description: >-
                    可选的公开 HTTP(S) 接口，用于接收任务完成通知。建议使用 HTTPS。省略、设为 null
                    或空字符串即关闭回调。
              description: model 和 callback_url 放在根级。工作流参数放在 input 内。
            examples:
              default:
                summary: Pip 与玻璃花园
                value:
                  model: blackforestlabs/flux-2-flex/edit
                  input:
                    prompt: >-
                      Create a children's picture-book illustration. Use image 1
                      as the exact character design for Pip the robot gardener:
                      the same round teal body, brass spout nose, amber lens
                      eyes, red knitted scarf, yellow rubber boots and tiny
                      brass watering can, with consistent proportions. Place Pip
                      inside the Victorian glasshouse from image 2, standing on
                      the wooden potting bench and carefully watering a row of
                      tomato seedlings in terracotta pots, with the white
                      cast-iron arches, mossy panes and hanging ferns clearly
                      recognisable. Render the whole scene in the risograph
                      print style of image 3: a limited palette of fluorescent
                      pink, teal, sunflower yellow and deep navy, visible grain,
                      halftone dots and slight layer misregistration on
                      off-white paper. Across the top, in large hand-lettered
                      risograph type, the title reads exactly "PIP AND THE GLASS
                      GARDEN". No other text, no watermark.
                    image_urls:
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-01.png
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-02.png
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-03.png
                    size: '3:2'
                    resolution: 1K
              flex-edit-02:
                summary: 由铅笔草图生成湖畔小屋
                value:
                  model: blackforestlabs/flux-2-flex/edit
                  input:
                    prompt: >-
                      Turn the pencil sketch in image 1 into a photorealistic
                      architectural photograph at blue-hour dusk. Follow the
                      sketch geometry precisely: the same A-frame silhouette,
                      stone base, large triangular glass front, narrow deck
                      extending over the lake, chimney on the right roof slope,
                      two pines on the left, and the same camera angle. Build
                      the cabin from the materials in image 2: charred black
                      cedar with alligator texture on the roof slopes, rough
                      dark basalt for the base, brushed copper for the chimney
                      and flashing, and pale oiled oak for the deck. Warm
                      interior light glows through the glass, a thin wisp of
                      smoke rises from the chimney, and the still lake mirrors
                      the cabin under a deep blue sky with the last orange light
                      on the horizon. Crisp material detail, realistic
                      reflections, 24mm architectural lens. No people, no text,
                      no watermark.
                    image_urls:
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/02/input-01.png
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/02/input-02.png
                    size: '16:9'
                    resolution: 1K
              flex-edit-03:
                summary: 海岛地图上的寻宝路线
                value:
                  model: blackforestlabs/flux-2-flex/edit
                  input:
                    prompt: >-
                      Edit the map in image 1 by adding only two new hand-drawn
                      elements in the same ink-and-watercolour style: a bold red
                      dashed route line that starts at the small harbour on the
                      south coast, follows the existing dotted trail north
                      through the fern valley, and ends at the lighthouse on the
                      northern cape; and a large hand-painted red X in the
                      middle of the fern valley with a tiny closed wooden
                      treasure chest drawn beside it. Keep every existing
                      element of image 1 exactly as it is, including all six
                      English labels in their original positions ("Whale Bay",
                      "Old Lighthouse", "Fern Valley", "Salt Marsh", "Seal
                      Rocks", "Lantern Harbor"), the coastline, forests,
                      marshes, rocks, compass rose, dotted trails, sailboats,
                      parchment texture and colours. No new text, no watermark.
                    image_urls:
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/03/input-01.png
                    size: '4:3'
                    resolution: 1K
              callback:
                summary: 接收完成回调
                value:
                  model: blackforestlabs/flux-2-flex/edit
                  input:
                    prompt: >-
                      Create a children's picture-book illustration. Use image 1
                      as the exact character design for Pip the robot gardener:
                      the same round teal body, brass spout nose, amber lens
                      eyes, red knitted scarf, yellow rubber boots and tiny
                      brass watering can, with consistent proportions. Place Pip
                      inside the Victorian glasshouse from image 2, standing on
                      the wooden potting bench and carefully watering a row of
                      tomato seedlings in terracotta pots, with the white
                      cast-iron arches, mossy panes and hanging ferns clearly
                      recognisable. Render the whole scene in the risograph
                      print style of image 3: a limited palette of fluorescent
                      pink, teal, sunflower yellow and deep navy, visible grain,
                      halftone dots and slight layer misregistration on
                      off-white paper. Across the top, in large hand-lettered
                      risograph type, the title reads exactly "PIP AND THE GLASS
                      GARDEN". No other text, no watermark.
                    image_urls:
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-01.png
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-02.png
                      - >-
                        https://cdn.vidgo.ai/apis/models/blackforestlabs/flux-2-flex/edit/v1/01/input-03.png
                    size: '3:2'
                    resolution: 1K
                  callback_url: https://your-domain.com/callback
      responses:
        '200':
          description: 任务已提交
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - data
                properties:
                  code:
                    type: integer
                    enum:
                      - 200
                  data:
                    type: object
                    required:
                      - task_id
                      - status
                      - created_time
                    properties:
                      task_id:
                        type: string
                      status:
                        type: string
                        enum:
                          - not_started
                          - running
                          - finished
                          - failed
                      created_time:
                        type: string
                        format: date-time
              example:
                code: 200
                data:
                  task_id: E4MB5ERGH360DFJI
                  status: running
                  created_time: '2026-09-26T11:07:59'
        '400':
          description: 输入无效、媒体无法访问或积分不足
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '401':
          description: 凭证无效
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '403':
          description: 拒绝访问
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '404':
          description: 模型未知或已停用
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '408':
          description: 请求超时
          content:
            text/plain:
              schema:
                type: string
              example: Request timeout
        '422':
          description: JSON 无效或请求体不是对象
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '429':
          description: 超出速率限制或 API Key 积分限额
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '500':
          description: 内部错误
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '502':
          description: 无法创建生成任务
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
        '503':
          description: 请求的模型暂时不可用
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 使用 VIDGO_API_KEY。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.