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

# Flux 3 Klein

> 基于参考图生成或编辑图像，输出最高 4K。

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

Flux 3 Klein 可根据文本生成图像，也可编辑或组合参考图。适用于产品摄影、插画和基于参考图的构图。

## 模型

* **flux-3-klein** — 文生图
* **flux-3-klein-edit** — 图像编辑，最多支持 10 张参考图

## 功能

* 每次请求生成 1–4 张图像，格式为 PNG、JPEG 或 WebP。
* 可选择 1K、2K 或 4K 输出，并指定宽高比或精确像素尺寸。
* 编辑或组合最多 10 张参考图。

## 输入模式

| 模式 | 模型 | 输入 |
| - | - | - |
| 文生图 | `flux-3-klein` | 在 `prompt` 中描述目标图像。 |
| 图像编辑 | `flux-3-klein-edit` | 提供 `prompt`，并在 `image_urls` 中提供 1–10 个 URL。 |

生成模型不接受参考图。编辑时，按提供顺序指代图像，例如“第一张图”。

## 必填参数

* `prompt` (string)：非空的完整目标图像描述，包括主体、构图、背景、光线以及希望进行的编辑。
* `image_urls` (array of strings)：仅 `flux-3-klein-edit` 必填。提供 1–10 个可公开访问的 HTTP(S) 参考图 URL。

## 可选参数

* `size` (string)：`1:1`、`4:3`、`3:4`、`16:9`、`9:16`、`3:2`、`2:3`，或精确的 `WIDTHxHEIGHT` 值。两种模式下默认均为 `1:1`。
* `resolution` (string)：`1K`、`2K` 或 `4K`。默认为 `1K`；使用自定义像素尺寸时需显式传入匹配的值。
* `n` (integer)：输出图像数量，取值 1 到 4。默认为 1。
* `output_format` (string)：`png`（默认）、`jpeg` 或 `webp`。
* `enable_safety_checker` (boolean)：启用内容安全检查。默认为 `true`。

## 尺寸

使用宽高比时，`resolution` 将长边设为 1024、2048 或 4096 像素。短边按所请求的比例计算，并取整到最接近的 16 的倍数。

使用自定义 `WIDTHxHEIGHT` 尺寸时，每边必须为 256–4096 像素且能被 16 整除。需按较长边确定的档位显式传入 `resolution`：

| 较长边 | 所需分辨率 |
| - | - |
| 256–1024 像素 | `1K` |
| 大于 1024 且不超过 2048 像素 | `2K` |
| 大于 2048 且不超过 4096 像素 | `4K` |

例如，`size: "1536x1024"` 需要 `resolution: "2K"`。

## 示例

OpenAPI 示例包括生成、参考图编辑和自定义尺寸。

## 注意事项

所有生成参数都放在 `input` 内；`callback_url` 位于请求顶层。


## OpenAPI

````yaml zh/api-manual/image-series/flux-3-klein.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: PoYo AI - Flux 3 Klein API
  description: 使用最多十张参考图像生成或编辑图像，支持 1K、2K 或 4K 输出。
  version: 1.0.0
servers:
  - url: https://api.poyo.ai
    description: 生产环境
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Flux 3 Klein
      summary: 提交 Flux 3 Klein 任务
      operationId: submitFlux3KleinTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              text-to-image:
                summary: 生成图像
                value:
                  model: flux-3-klein
                  input:
                    prompt: A red fox in fresh snow at sunrise
                    size: '3:2'
                    resolution: 2K
              edit-image:
                summary: 编辑参考图像
                value:
                  model: flux-3-klein-edit
                  input:
                    prompt: >-
                      Keep the product from the first image and place it in a
                      sunlit studio
                    image_urls:
                      - https://example.com/product.png
                    size: '4:3'
                    resolution: 1K
              custom-size:
                summary: 使用精确像素尺寸
                value:
                  model: flux-3-klein
                  input:
                    prompt: An editorial portrait with soft window light
                    size: 1536x1024
                    resolution: 2K
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          enum:
            - flux-3-klein
            - flux-3-klein-edit
          description: 公开的模型标识。
        callback_url:
          type: string
          format: uri
          description: 任务完成或失败时接收通知的 Webhook URL。
        input:
          type: object
          required:
            - prompt
          additionalProperties: false
          properties:
            prompt:
              type: string
              minLength: 1
              description: 描述完整的目标图像，包括主体、构图、背景和光照。必须包含非空白文本。
            image_urls:
              type: array
              minItems: 1
              maxItems: 10
              items:
                type: string
                format: uri
              description: >-
                仅 flux-3-klein-edit 必填。提供 1-10 个参考图像 URL。flux-3-klein
                请勿传此字段。必须是可公开访问的 HTTP 或 HTTPS URL。
            size:
              type: string
              default: '1:1'
              description: >-
                输出宽高比：1:1、4:3、3:4、16:9、9:16、3:2 或 2:3；或精确的 WIDTHxHEIGHT
                像素值。自定义尺寸的宽和高均须在 256-4096 之间、能被 16 整除，并显式指定匹配的 resolution。
            resolution:
              type: string
              enum:
                - 1K
                - 2K
                - 4K
              default: 1K
              description: >-
                输出分辨率档位。使用宽高比时，长边为 1024、2048 或 4096 像素，短边四舍五入到最接近的 16
                的倍数。使用自定义尺寸时，由长边决定档位：不超过 1024 为 1K，大于 1024 且不超过 2048 为 2K，大于
                2048 且不超过 4096 为 4K。
            'n':
              type: integer
              minimum: 1
              maximum: 4
              default: 1
              description: 输出图像数量。
            output_format:
              type: string
              enum:
                - jpeg
                - png
                - webp
              default: png
              description: 输出图像格式。
            enable_safety_checker:
              type: boolean
              default: true
              description: 启用内容安全检查。
          description: 所选模型的参数。媒体字段仅在对应模式下必填。
      description: 使用最多十张参考图像生成或编辑图像，支持 1K、2K 或 4K 输出。
      x-poyo-model-requests:
        $ref: '#/components/schemas/ModelRequests'
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          example: 200
          description: >-
            业务状态码。`200` 表示成功，其他值都表示请求失败。请务必检查这个字段：部分参数校验错误会以 HTTP 200 返回，响应体里的
            `code` 为 `400`。


            - `200`：成功

            - `400`：请求参数无效

            - `401`：API Key 缺失或无效

            - `402`：积分不足

            - `403`：没有权限

            - `404`：资源不存在

            - `408`：请求超时

            - `429`：请求频率超限

            - `500`：服务器内部错误

            - `502`：上游服务错误

            - `503`：服务暂不可用


            详见[错误码](/zh/api-manual/error-codes)。
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-unified-1792468800-example
            status:
              type: string
              enum:
                - not_started
                - running
                - finished
                - failed
              example: not_started
              description: >-
                任务状态。提交后立即返回时始终为
                `not_started`。后续状态请通过[查询任务状态](/zh/api-manual/task-management/status)接口或
                `callback_url` 获取。


                - `not_started`：排队中，等待处理

                - `running`：生成中

                - `finished`：已完成，结果在 `files` 或 `output` 中

                - `failed`：失败，详情见 `error_message`
            created_time:
              type: string
              format: date-time
              example: '2026-10-20T12:00:00'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        所有 API 接口都需要 Bearer Token 认证。


        创建 API Key：登录 PoYo，进入 **仪表盘 → API
        密钥**（[poyo.ai/zh/dashboard/api-key](https://poyo.ai/zh/dashboard/api-key)），点击创建
        Key。


        在请求头中添加：


        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````

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