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

> Flux 3 API 可根据文本、一张起始图片、首尾帧或最多十个关键帧生成视频，也可续写已有的 MP4。

> [!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/text-to-video` | 无 |
| `flux-3/image-to-video` | `image_urls` 中一张图片 |
| `flux-3/first-last-frame-to-video` | `image_urls` 中两张按顺序排列的图片 |
| `flux-3/extend-video` | `video_url` 中一个 MP4 |
| `flux-3/keyframes-to-video` | `keyframes` 中 1-10 项 |

各模型的具体要求和限制见下方参数说明。

## 模型

* **flux-3/text-to-video** — 文生视频
* **flux-3/image-to-video** — 图生视频
* **flux-3/first-last-frame-to-video** — 首尾帧生视频
* **flux-3/extend-video** — 视频续写
* **flux-3/keyframes-to-video** — 关键帧生视频


## OpenAPI

````yaml zh/api-manual/video-series/flux-3.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: PoYo AI - Flux 3 Video API
  description: 根据文本、图像、首尾帧、源视频或定位关键帧创建视频。
  version: 1.0.0
servers:
  - url: https://api.poyo.ai
    description: 生产环境
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Flux 3
      summary: 提交 Flux 3 视频任务
      operationId: submitFlux3VideoTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              text-to-video:
                summary: 文生视频
                value:
                  model: flux-3/text-to-video
                  input:
                    prompt: A red panda walks through a sunlit forest
                    duration: 5
                    resolution: 720p
              image-to-video:
                summary: 图生视频
                value:
                  model: flux-3/image-to-video
                  input:
                    prompt: The camera slowly moves closer
                    image_urls:
                      - https://example.com/start.png
              first-last-frame:
                summary: 首尾帧
                value:
                  model: flux-3/first-last-frame-to-video
                  input:
                    prompt: Transition smoothly between both scenes
                    duration: 5
                    image_urls:
                      - https://example.com/start.png
                      - https://example.com/end.png
              extend-video:
                summary: 延长视频
                value:
                  model: flux-3/extend-video
                  input:
                    prompt: Continue tracking as the subject turns
                    video_url: https://example.com/source.mp4
              keyframes:
                summary: 关键帧生视频
                value:
                  model: flux-3/keyframes-to-video
                  input:
                    prompt: Move smoothly through the keyframes
                    duration: 5
                    keyframes:
                      - image_url: https://example.com/frame-1.png
                        frame_index: 0
                      - image_url: https://example.com/frame-2.png
                        frame_index: 120
      responses:
        '200':
          description: 任务已提交
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权：API Key 无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: 要使用的 Flux 3 工作流。所选模型决定必填的媒体输入字段。
          enum:
            - flux-3/text-to-video
            - flux-3/image-to-video
            - flux-3/first-last-frame-to-video
            - flux-3/extend-video
            - flux-3/keyframes-to-video
        callback_url:
          type: string
          format: uri
          description: 接收 finished 或 failed 结果的 Webhook URL。
        input:
          $ref: '#/components/schemas/Flux3Input'
    SubmitResponse:
      type: object
      properties:
        code:
          type: integer
          example: 200
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          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
          properties:
            task_id:
              type: string
            status:
              type: string
              example: not_started
              enum:
                - not_started
                - running
                - finished
                - failed
              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
    ErrorResponse:
      type: object
      required:
        - code
        - error
      properties:
        code:
          type: integer
          example: 400
          enum:
            - 200
            - 400
            - 401
            - 402
            - 403
            - 404
            - 408
            - 429
            - 500
            - 502
            - 503
          description: >-
            业务状态码。`200` 表示成功，其他值都表示请求失败。请务必检查这个字段：部分参数校验错误会以 HTTP 200 返回，响应体里的
            `code` 为 `400`。


            - `200`：成功

            - `400`：请求参数无效

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

            - `402`：积分不足

            - `403`：没有权限

            - `404`：资源不存在

            - `408`：请求超时

            - `429`：请求频率超限

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

            - `502`：上游服务错误

            - `503`：服务暂不可用


            详见[错误码](/zh/api-manual/error-codes)。
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
    Flux3Input:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          minLength: 1
          description: 描述期望的场景、运动和镜头行为（所有 Flux 3 模型）。
        duration:
          type: integer
          minimum: 5
          maximum: 20
          default: 5
          description: 输出时长，单位为秒（所有 Flux 3 模型）。
        resolution:
          type: string
          enum:
            - 720p
            - 1080p
          default: 720p
          description: 输出分辨率（所有 Flux 3 模型）。
        aspect_ratio:
          type: string
          enum:
            - auto
            - '21:9'
            - '2:1'
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
          default: auto
          description: 输出宽高比（所有 Flux 3 模型）。
        sound:
          type: boolean
          default: true
          description: 是否生成音频（所有 Flux 3 模型）。
        image_urls:
          type: array
          minItems: 1
          maxItems: 2
          items:
            type: string
            format: uri
          description: >-
            源图像 URL（仅限 image-to-video 和
            first-last-frame-to-video）。这些模型必填：flux-3/image-to-video 需提供恰好 1
            张图像，flux-3/first-last-frame-to-video 需按顺序提供恰好 2 张图像。两张图像时，第 0 项为首帧，第
            1 项为尾帧。
          example:
            - https://example.com/start.png
        video_url:
          type: string
          format: uri
          description: >-
            源视频 URL（仅限 flux-3/extend-video，必填）。必须是 HTTP(S) MP4 文件，小于 50 MB 且短于
            15 秒。
          example: https://example.com/source.mp4
        keyframes:
          type: array
          minItems: 1
          maxItems: 10
          items:
            $ref: '#/components/schemas/Keyframe'
          description: >-
            定位参考图（仅限 flux-3/keyframes-to-video，必填）。提供 1–10 个关键帧，frame_index 值在
            24 fps 时间轴上互不重复。
    Keyframe:
      type: object
      required:
        - image_url
        - frame_index
      properties:
        image_url:
          type: string
          format: uri
          description: 该关键帧的图像 URL（仅限 flux-3/keyframes-to-video，必填）。
        frame_index:
          type: integer
          minimum: 0
          description: 唯一的时间轴位置，取值 0 到 duration × 24（仅限 flux-3/keyframes-to-video，必填）。
  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.