> ## 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.

# 使用 FLUX 3 生成视频

> 使用 BFL 官方格式通过 FLUX 3 生成视频。支持文生视频、图像/关键帧生成视频、视频续接以及草稿增强工作流。<a href='https://docs.bfl.ai/api-reference/utility/generate-a-video-with-flux-3' target='_blank'>官方文档</a>



## OpenAPI

````yaml openapi/cn/flux.json POST /bfl/v1/flux-3-video
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-video:
    post:
      description: >-
        使用 BFL 官方格式通过 FLUX 3 生成视频。支持文生视频、图像/关键帧生成视频、视频续接以及草稿增强工作流。<a
        href='https://docs.bfl.ai/api-reference/utility/generate-a-video-with-flux-3'
        target='_blank'>官方文档</a>
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - title: 文生视频
                  type: object
                  properties:
                    prompt:
                      type: string
                      description: 用于描述视频内容的自由格式提示词。
                    mode:
                      type: string
                      description: 允许的值："t2v"
                      default: t2v
                    aspect_ratio:
                      type: string
                      description: 输出视频的宽高比。auto 表示根据提示词以及输入的参考内容自动选择。
                      default: auto
                      enum:
                        - auto
                        - '21:9'
                        - '2:1'
                        - '16:9'
                        - '4:3'
                        - '1:1'
                        - '3:4'
                        - '9:16'
                    duration:
                      oneOf:
                        - type: integer
                          minimum: 5
                          maximum: 20
                        - type: string
                          enum:
                            - auto
                      description: 视频时长，单位为秒。支持 5 到 20 秒之间的任意整数，也可以设置为 auto 以根据内容自动确定时长。
                      default: auto
                    resolution:
                      type: string
                      description: 视频分辨率级别：hd，或 fhd（由视频超分辨率处理器完成更高分辨率的输出）。具体尺寸会根据宽高比有所不同。
                      default: hd
                      enum:
                        - hd
                        - fhd
                    version:
                      type: string
                      description: 接口版本。`latest` 表示使用当前版本。
                      example: latest
                      enum:
                        - latest
                    generate_audio:
                      type: boolean
                      description: 是否在生成视频的同时生成与视频同步的音频。
                      default: true
                    safety_tolerance:
                      type: integer
                      description: >-
                        输入和输出内容安全审核的容忍度等级。取值范围为 0 到 4，其中 0
                        最严格。无论请求的容忍度设置为何，色情内容最高允许等级为 3，仇恨内容最高允许等级为
                        2。系统可能会根据上下文安全信号进一步收紧所请求的等级。
                      minimum: 0
                      maximum: 4
                      default: 2
                    draft:
                      type: boolean
                      description: >-
                        草稿模式：快速生成预览，并在结果中返回一个 draft_cache 下载
                        URL。下载该缓存包后，可以在之后的请求中将其传回，以生成相同内容的完整质量版本。
                      default: false
                    webhook_url:
                      type: string
                      description: >-
                        TTAPI 异步回调地址。初始响应会返回 `jobId`；可以通过该回调地址或 Flux
                        查询接口获取最终视频结果。
                  required:
                    - mode
                    - prompt
                - title: 图生视频
                  description: >-
                    图像续接：输入的图像将作为视频中的关键帧。一张图像用于确定视频起始画面；两张图像分别确定起始和结束画面；如果有更多图像，则第一张作为起始画面，最后一张作为结束画面，其余图像会均匀分布在中间。如果需要自行控制时间点，可以发送
                    [秒数, 图像] 对：每张图像都会对应到指定的时间点。
                  type: object
                  properties:
                    prompt:
                      type: string
                      description: 用于描述视频内容的自由格式提示词。
                    mode:
                      type: string
                      description: 允许的值："i2v"
                      default: i2v
                    keyframes:
                      oneOf:
                        - type: string
                        - type: array
                      description: >-
                        输入图像将作为视频中的关键帧；每张图像可以是 http(s) URL 或 base64，最多支持 10
                        张。普通图像模式下：一张图像作为视频起始画面；两张图像分别作为起始和结束画面；三张或更多图像时，第一张作为起始画面，最后一张作为结束画面，其余图像均匀分布在中间（3
                        张或更多图像需要设置具体时长）。如果需要自行控制时间点，可以按时间顺序发送 [秒数, 图像] 对，例如 [[0,
                        "..."], [3.5, "..."]]：每张图像都会对应到指定的时间点。当 duration 设置为
                        "auto" 时，视频将持续到最后一个时间点，并向上取整，最长 20 秒。
                    aspect_ratio:
                      type: string
                      description: 输出视频的宽高比。auto 表示根据提示词以及输入的参考内容自动选择。
                      default: auto
                      enum:
                        - auto
                        - '21:9'
                        - '2:1'
                        - '16:9'
                        - '4:3'
                        - '1:1'
                        - '3:4'
                        - '9:16'
                    duration:
                      oneOf:
                        - type: integer
                          minimum: 5
                          maximum: 20
                        - type: string
                          enum:
                            - auto
                      description: 视频时长，单位为秒。支持 5 到 20 秒之间的任意整数，也可以设置为 auto 以根据内容自动确定时长。
                      default: auto
                    resolution:
                      type: string
                      description: 视频分辨率级别：hd，或 fhd（由视频超分辨率处理器完成更高分辨率的输出）。具体尺寸会根据宽高比有所不同。
                      default: hd
                      enum:
                        - hd
                        - fhd
                    version:
                      type: string
                      description: 接口版本。`latest` 表示使用当前版本。
                      example: latest
                      enum:
                        - latest
                    generate_audio:
                      type: boolean
                      description: 是否在生成视频的同时生成与视频同步的音频。
                      default: true
                    safety_tolerance:
                      type: integer
                      description: >-
                        输入和输出内容安全审核的容忍度等级。取值范围为 0 到 4，其中 0
                        最严格。无论请求的容忍度设置为何，色情内容最高允许等级为 3，仇恨内容最高允许等级为
                        2。系统可能会根据上下文安全信号进一步收紧所请求的等级。
                      minimum: 0
                      maximum: 4
                      default: 2
                    draft:
                      type: boolean
                      description: >-
                        草稿模式：快速生成预览，并在结果中返回一个 draft_cache 下载
                        URL。下载该缓存包后，可以在之后的请求中将其传回，以生成相同内容的完整质量版本。
                      default: false
                    webhook_url:
                      type: string
                      description: >-
                        TTAPI 异步回调地址。初始响应会返回 `jobId`；可以通过该回调地址或 Flux
                        查询接口获取最终视频结果。
                  required:
                    - mode
                    - prompt
                    - keyframes
                - title: 视频续接
                  description: 视频续接：生成的视频片段会从输入视频的最后几帧继续延伸。
                  type: object
                  properties:
                    prompt:
                      type: string
                      description: 用于描述视频内容的自由格式提示词。
                    mode:
                      type: string
                      description: 允许的值："v2v"
                      default: v2v
                    start_video:
                      type: string
                      description: >-
                        需要进行续接的视频，可以是 http(s) URL 或 base64 编码的 mp4
                        视频。生成的视频片段会从输入视频的最后几帧继续延伸。
                    aspect_ratio:
                      type: string
                      description: 输出视频的宽高比。auto 表示根据提示词以及输入的参考内容自动选择。
                      default: auto
                      enum:
                        - auto
                        - '21:9'
                        - '2:1'
                        - '16:9'
                        - '4:3'
                        - '1:1'
                        - '3:4'
                        - '9:16'
                    duration:
                      oneOf:
                        - type: integer
                          minimum: 5
                          maximum: 20
                        - type: string
                          enum:
                            - auto
                      description: 视频时长，单位为秒。支持 5 到 20 秒之间的任意整数，也可以设置为 auto 以根据内容自动确定时长。
                      default: auto
                    resolution:
                      type: string
                      description: 视频分辨率级别：hd，或 fhd（由视频超分辨率处理器完成更高分辨率的输出）。具体尺寸会根据宽高比有所不同。
                      default: hd
                      enum:
                        - hd
                        - fhd
                    version:
                      type: string
                      description: 接口版本。`latest` 表示使用当前版本。
                      example: latest
                      enum:
                        - latest
                    generate_audio:
                      type: boolean
                      description: 是否在生成视频的同时生成与视频同步的音频。
                      default: true
                    safety_tolerance:
                      type: integer
                      description: >-
                        输入和输出内容安全审核的容忍度等级。取值范围为 0 到 4，其中 0
                        最严格。无论请求的容忍度设置为何，色情内容最高允许等级为 3，仇恨内容最高允许等级为
                        2。系统可能会根据上下文安全信号进一步收紧所请求的等级。
                      minimum: 0
                      maximum: 4
                      default: 2
                    draft:
                      type: boolean
                      description: >-
                        草稿模式：快速生成预览，并在结果中返回一个 draft_cache 下载
                        URL。下载该缓存包后，可以在之后的请求中将其传回，以生成相同内容的完整质量版本。
                      default: false
                    webhook_url:
                      type: string
                      description: >-
                        TTAPI 异步回调地址。初始响应会返回 `jobId`；可以通过该回调地址或 Flux
                        查询接口获取最终视频结果。
                  required:
                    - mode
                    - prompt
                    - start_video
                - title: 草稿增强
                  description: >-
                    对之前生成的草稿进行完整质量渲染。该缓存包会锁定原始生成任务本身，包括原始模式、提示词、随机种子以及条件输入媒体，因此调用方只需要选择输出分辨率。
                  type: object
                  properties:
                    mode:
                      type: string
                      description: 允许的值："draft_enhance"
                      default: draft_enhance
                    draft_cache:
                      type: string
                      description: >-
                        来自之前草稿生成任务的加密 draft-cache 缓存包。主要形式为从之前结果中的 draft_cache
                        URL 下载得到的 .bin 文件，并将其进行 base64 编码。也支持传入 http(s)
                        URL，但仅适用于在下载 URL 有效期内重新执行任务。执行时会跳过中间处理流程，并以完整质量重新执行原始
                        FLUX 调用；原始输入内容已包含在该缓存包中。
                    resolution:
                      type: string
                      description: >-
                        增强后视频的分辨率级别：fhd（默认）表示使用视频超分辨率处理器完成最终增强，hd
                        表示不执行该增强处理。无论选择哪种分辨率，重现的生成过程本身完全一致，区别仅在于最终的增强处理步骤。
                      default: fhd
                      enum:
                        - hd
                        - fhd
                    safety_tolerance:
                      type: integer
                      description: >-
                        输入和输出内容安全审核的容忍度等级。取值范围为 0 到 4，其中 0
                        最严格。无论请求的容忍度设置为何，色情内容最高允许等级为 3，仇恨内容最高允许等级为
                        2。系统可能会根据上下文安全信号进一步收紧所请求的等级。
                      minimum: 0
                      maximum: 4
                      default: 2
                    webhook_url:
                      type: string
                      description: >-
                        TTAPI 异步回调地址。初始响应会返回 `jobId`；可以通过该回调地址或 Flux
                        查询接口获取最终视频结果。
                  required:
                    - mode
                    - draft_cache
      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 密钥。

````