> ## 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 3 Klein 文生图

> FLUX 3 Klein 文生图 API 根据提示词生成 1–4 张 1K、2K 或 4K 图片，支持 7 种宽高比或自定义尺寸，输出 PNG、JPEG 或 WebP。

> [!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 3 Klein 文生图根据提示词生成 1K、2K 或 4K 图片，可使用七种宽高比预设或精确的自定义尺寸。适合产品图、营销素材、概念设计，以及注重出图速度的大批量图片流程。

FLUX 3 Klein 是 Black Forest Labs FLUX 3 图像系列中的轻量模型，主打快速生成和基于指令的编辑。Vidgo 提供两个 model ID：[文生图](https://docs.vidgo.ai/zh/api-manual/image-series/blackforestlabs-flux-3-klein-text-to-image.md)和[图像编辑](https://docs.vidgo.ai/zh/api-manual/image-series/blackforestlabs-flux-3-klein-edit.md)。

## 模型

* **blackforestlabs/flux-3-klein/text-to-image** — FLUX 3 Klein 文生图，1–4 张，1K、2K 或 4K。

## 功能

* 只需一段提示词即可文生图。
* 三档分辨率：`1K`、`2K`、`4K`。
* 七种宽高比预设，或每边 256 到 4096 像素的自定义 `WIDTHxHEIGHT`。
* 输出 PNG、JPEG 或 WebP，每次请求 1–4 张。

## 必填参数

* `prompt`（string）：想要的画面。不能为空白。

## 可选参数

* `n`（integer）：图片张数，`1`–`4`。默认 `1`。
* `resolution`（string）：`1K`、`2K` 或 `4K`。默认 `1K`。见[分辨率](#分辨率)。
* `size`（string）：预设或自定义 `WIDTHxHEIGHT`。默认 `1:1`。见[分辨率](#分辨率)。
* `output_format`（string）：`png`、`jpeg` 或 `webp`。默认 `png`。
* `enable_safety_checker`（boolean）：上游安全检查。默认 `true`。

## 分辨率

* 使用预设 `size`（`1:1`、`4:3`、`3:4`、`16:9`、`9:16`、`3:2`、`2:3`）时，图片会按档位缩放长边：`1K` → 1024 像素，`2K` → 2048 像素，`4K` → 4096 像素。
* 使用自定义 `size`（如 `1920x1080`）时，每边须为 256–4096 且为 16 的倍数，并且必须传入与长边匹配的 `resolution`：不超过 1024 用 `1K`，不超过 2048 用 `2K`，超过 2048 用 `4K`。不匹配会返回 400。

| `resolution` | 长边（预设） | 自定义长边 |
| - | - | - |
| `1K` | 1024 像素 | ≤ 1024 像素 |
| `2K` | 2048 像素 | 1025–2048 像素 |
| `4K` | 4096 像素 | 2049–4096 像素 |

## 输出

任务完成后，[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)和回调内容的 `files` 数组中会按请求的张数（`n`）返回对应数量的图片文件。

## 示例

* **1K 方形图片**：`1:1`、`1K`、PNG 格式的产品图。
* **自定义 4K 尺寸，两张 JPEG，带回调**：`size: 3840x2160` 搭配 `resolution: 4K`（长边超过 2048），`n: 2`，JPEG，并提供 `callback_url`。

## 注意事项

* 本 ID 只接受文本，传 `image_urls` 会返回 400。要编辑或合成图片，请用 [FLUX 3 Klein 图像编辑](https://docs.vidgo.ai/zh/api-manual/image-series/blackforestlabs-flux-3-klein-edit.md)。
* 上文未列出的字段会返回 400。`model` 和 `callback_url` 放在请求根级，不要放进 `input`。
* 积分在提交时预扣，取决于 `resolution` 和 `n`。文生图与图像编辑费率相同。任务失败会全额退还。当前费率见[定价页](https://vidgo.ai/apis/api-pricing)。


## OpenAPI

````yaml zh/api-manual/image-series/blackforestlabs-flux-3-klein-text-to-image.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - FLUX 3 Klein 文生图
  description: >-
    FLUX 3 Klein 文生图 API 根据提示词生成 1–4 张 1K、2K 或 4K 图片，支持 7 种宽高比或自定义尺寸，输出 PNG、JPEG
    或 WebP。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Image Series
      summary: FLUX 3 Klein 文生图
      description: >-
        只传本模型列出的 `input` 字段。其他字段（包括 `image_urls`）都会返回 400。自定义 `WIDTHxHEIGHT`
        尺寸需要传入与其长边匹配的 `resolution`。
      operationId: submit_blackforestlabs_flux_3_klein_text_to_image
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              properties:
                model:
                  type: string
                  description: 模型 ID，填 `blackforestlabs/flux-3-klein/text-to-image`。
                  example: blackforestlabs/flux-3-klein/text-to-image
                callback_url:
                  type: string
                  format: uri
                  nullable: true
                  description: >-
                    可选的公开 HTTP(S) 地址，任务变为 `finished` 或 `failed` 时会收到 POST
                    请求。建议使用 HTTPS。省略、传 `null` 或空字符串即不发送回调。
                  example: https://your-domain.com/callback
                input:
                  type: object
                  required:
                    - prompt
                  properties:
                    prompt:
                      type: string
                      minLength: 1
                      example: >-
                        Studio product photo of a matte black water bottle on
                        wet slate, soft rim light
                      description: 描述画面的文本提示词。不能为空白。
                    'n':
                      type: integer
                      minimum: 1
                      maximum: 4
                      default: 1
                      description: 生成的图片张数。
                    resolution:
                      type: string
                      enum:
                        - 1K
                        - 2K
                        - 4K
                      default: 1K
                      description: >-
                        分辨率档位（不区分大小写）。预设尺寸会按长边 1024、2048 或 4096
                        像素缩放。决定计费档位。使用自定义 `size` 时，需传入与其长边匹配的档位。
                    size:
                      type: string
                      default: '1:1'
                      example: '16:9'
                      description: >-
                        宽高比预设（`1:1`、`4:3`、`3:4`、`16:9`、`9:16`、`3:2`、`2:3`），或自定义
                        `WIDTHxHEIGHT`：每边 256–4096 且为 16 的倍数。自定义尺寸需显式传入与长边匹配的
                        `resolution`：不超过 1024 用 `1K`，不超过 2048 用 `2K`，否则用 `4K`。
                    output_format:
                      type: string
                      enum:
                        - png
                        - jpeg
                        - webp
                      default: png
                      description: 图片文件格式。
                    enable_safety_checker:
                      type: boolean
                      default: true
                      description: 启用上游安全检查。
                  additionalProperties: false
                  description: 生成参数。
            examples:
              preset:
                summary: 1K 方形图片
                value:
                  model: blackforestlabs/flux-3-klein/text-to-image
                  input:
                    prompt: >-
                      Studio product photo of a matte black water bottle on wet
                      slate, soft rim light
                    'n': 1
                    resolution: 1K
                    size: '1:1'
                    output_format: png
              custom_4k:
                summary: 自定义 4K 尺寸，两张 JPEG，带回调
                value:
                  model: blackforestlabs/flux-3-klein/text-to-image
                  callback_url: https://your-domain.com/callback
                  input:
                    prompt: >-
                      Aerial view of terraced rice fields at golden hour, mist
                      in the valleys, ultra detailed
                    'n': 2
                    resolution: 4K
                    size: 3840x2160
                    output_format: jpeg
                    enable_safety_checker: true
      responses:
        '200':
          description: 任务已提交
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - data
                properties:
                  code:
                    type: integer
                    enum:
                      - 200
                    description: HTTP 状态码。
                  data:
                    type: object
                    required:
                      - task_id
                      - status
                      - created_time
                    properties:
                      task_id:
                        type: string
                        description: >-
                          任务
                          ID，用于[查询任务状态](/zh/api-manual/task-management/status)。
                      status:
                        type: string
                        enum:
                          - not_started
                        description: 任务的初始状态。
                      created_time:
                        type: string
                        format: date-time
                        description: 任务创建时间（ISO 8601）。
              example:
                code: 200
                data:
                  task_id: task-unified-1762160000-abc123
                  status: not_started
                  created_time: '2026-11-03T10:30:00'
        '400':
          description: 输入无效、字段不受支持、媒体无法访问或积分不足
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '401':
          description: 凭证无效
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '403':
          description: 拒绝访问
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '404':
          description: 模型未知或已停用
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '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: {}
                    description: 错误信息。
        '429':
          description: 超出速率限制或 API Key 积分限额
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '500':
          description: 内部错误
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '502':
          description: 无法创建上游生成任务
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
        '503':
          description: 所请求的模型暂时不可用
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    oneOf:
                      - type: string
                      - type: object
                        additionalProperties: true
                      - type: array
                        items: {}
                    description: 错误信息。
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        所有 API 接口都需要 Bearer Token 认证


        获取 API Key：


        进入 **仪表盘 → API 密钥**（[API Key
        管理页面](https://vidgo.ai/apis/dashboard/api-key)）获取你的 API Key


        在请求头中添加：


        ```

        Authorization: Bearer VIDGO_API_KEY

        ```

````

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