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

> ## Agent Instructions
> Send API requests to https://api.ttapi.io with the TT-API-KEY header. Midjourney account hosting uses https://hold.ttapi.io. Claude Code uses https://cc.ttapi.io.
> Most generation endpoints are asynchronous. The submit response returns a job id. Poll that product's fetch endpoint, or pass a webhook on the submit request. A fetch call does not start a new generation.
> 1 USD = 100 quota. Check the pricing page for that product before estimating cost.
> This file lists the English docs. Follow every /_llms/ link recursively for the API reference, Chinese, and Russian. Open a page's .md URL for the endpoint schema.

# 使用 FLUX 3 Image Klein 生成图像

> 使用 FLUX 3 Image Klein API 生成或编辑图像。它与 FLUX 3 Image 同属图像系列，体积更小、速度更快，并支持指定宽高、种子和采样步数。



## OpenAPI

````yaml openapi/cn/flux.json POST /bfl/v1/flux-3-image-klein
openapi: 3.1.0
info:
  title: Flux API DOCS
  version: 1.0.0
  description: TTAPI Flux API 接口服务，目前集成了市场上最为领先的视频大模型sora2。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /bfl/v1/flux-3-image-klein:
    post:
      description: >-
        使用 FLUX 3 Image Klein 生成或编辑图像。它与 FLUX 3 Image 同属图像系列，支持文生图、最多 10
        张参考图编辑、多图合成和提示词中的边界框。Klein 额外支持精确宽高、随机种子、输出格式和采样步数。接口会自动扩展提示词。同时传入
        `width` 和 `height` 时，会覆盖 `aspect_ratio` 和 `resolution`。<a
        href='https://docs.bfl.ai/api-reference/utility/generate-an-image-with-flux-3-klein'
        target='_blank'>官方文档</a>
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: >-
                    用于描述图像的自由格式提示词。不传 `images`
                    时按提示词生成新图像；传入参考图时，写明要修改的内容，并按顺序称为图 1、图 2。也可以在提示词末尾附加边界框，用 0
                    到 1000 的 `[top, left, bottom, right]` 指定元素位置。
                images:
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: string
                      minItems: 1
                      maxItems: 10
                  description: >-
                    可选参考图。不传时为文生图；传入后按提示词编辑、换风格或合成。每张为 http(s) URL 或 base64，共 1
                    到 10 张。第一张是被编辑的图像，并决定默认输出尺寸。
                aspect_ratio:
                  type: string
                  description: >-
                    输出图像宽高比。`auto` 时，有参考图则使用第一张的精确比例；没有参考图时先根据提示词选择比例，否则使用
                    `16:9`。同时传入 `width` 和 `height` 时忽略该字段。
                  default: auto
                  enum:
                    - auto
                    - '21:9'
                    - '2:1'
                    - '16:9'
                    - '3:2'
                    - '7:5'
                    - '4:3'
                    - '5:4'
                    - '1:1'
                    - '4:5'
                    - '3:4'
                    - '5:7'
                    - '2:3'
                    - '9:16'
                    - '1:2'
                    - '9:21'
                resolution:
                  type: string
                  description: >-
                    图像分辨率档位：`768sq`、`1k`、`1.5k`、`2k`、`4k`。文生图省略时为
                    `1k`；有参考图且省略时使用第一张自身尺寸，若同时设置了 `aspect_ratio` 则取最接近的档位。同时传入
                    `width` 和 `height` 时忽略该字段。
                  enum:
                    - 768sq
                    - 1k
                    - 1.5k
                    - 2k
                    - 4k
                width:
                  type: integer
                  description: >-
                    输出宽度，单位为像素，范围 64 到 6256。必须与 `height` 一起传入，并覆盖 `aspect_ratio`
                    和 `resolution`。宽乘高不超过 16822272 像素。
                  minimum: 64
                  maximum: 6256
                height:
                  type: integer
                  description: 输出高度，单位为像素，范围 64 到 6256。必须与 `width` 一起传入。宽乘高不超过 16822272 像素。
                  minimum: 64
                  maximum: 6256
                seed:
                  type: integer
                  description: 随机种子，用于复现结果。省略时随机。取值范围 0 到 4294967295。
                  minimum: 0
                  maximum: 4294967295
                safety_tolerance:
                  type: integer
                  description: 内容安全审核容忍度，取值 0 到 7，0 最严格，默认 2。允许的最高等级以及各类内容上限由路由和组织决定。
                  minimum: 0
                  maximum: 7
                  default: 2
                output_format:
                  type: string
                  description: 输出图像格式。
                  default: jpeg
                  enum:
                    - jpeg
                    - png
                steps:
                  type: integer
                  description: 去噪采样步数，默认 16。取值范围 1 到 16。
                  minimum: 1
                  maximum: 16
                  default: 16
                webhook_url:
                  type: string
                  description: >-
                    异步回调地址。初始响应会返回 `jobId`；可以通过该回调地址或 [Flux
                    查询接口](/api/cn/flux/fetch) 获取最终图像结果。
              required:
                - prompt
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  responses:
    SuccessResponse:
      description: 请求成功
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            required:
              - status
              - message
              - data
    400Response:
      description: 参数错误
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: 授权失败
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````

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