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

# 参考文件生视频

> 创建参考文件生视频任务

这是 **Wan 3.0 视频生成 API** 的参考文件生视频接口。通过 `file` 类型传入文件，模型自动理解文件内容生成视频。


## OpenAPI

````yaml openapi/cn/wan-file-to-video.json POST /wan/api/v1/services/aigc/video-generation/video-synthesis
openapi: 3.1.0
info:
  title: Wan 3.0 - File to Video DOCS
  version: 1.0.0
  description: Wan 3.0 参考文件生视频 API - 通过 file 类型传入文件，模型自动理解文件内容生成视频。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /wan/api/v1/services/aigc/video-generation/video-synthesis:
    post:
      description: 创建参考文件生视频任务
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileToVideoRequest'
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  output:
                    type: object
                    properties:
                      task_status:
                        type: string
                        description: 任务状态
                        enum:
                          - PENDING
                          - RUNNING
                          - SUCCEEDED
                          - FAILED
                          - CANCELED
                          - UNKNOWN
                        example: PENDING
                      task_id:
                        type: string
                        description: 任务 ID。查询有效期 24 小时。
                        example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
                  request_id:
                    type: string
                    description: 请求唯一标识。
                    example: 4909100c-7b5a-9f92-bfe5-xxxxxx
      security:
        - CustomApiKey: []
components:
  schemas:
    FileToVideoRequest:
      type: object
      description: 参考文件生视频请求参数
      properties:
        model:
          type: string
          description: |-
            模型名称。可选值：
            - `wan3.0-video`：标准版。
          enum:
            - wan3.0-video
          example: wan3.0-video
        input:
          type: object
          description: 输入的基本信息。prompt 和 media 必填其一。
          properties:
            prompt:
              type: string
              description: 文本提示词，用来描述期望生成的视频内容。支持中英文，不超过 20000 个字符。
            media:
              type: array
              description: '媒体素材数组。参考文件生视频模式下，使用 type: ''file'' 传入文件。'
              items:
                type: object
                properties:
                  type:
                    type: string
                    description: 媒体素材类型。参考文件生视频使用 `file` 类型。最多 1 个，不可与 link 同时输入。
                    enum:
                      - file
                    example: file
                  url:
                    type: string
                    description: 文件 URL 或 Base64 编码数据。
                required:
                  - type
                  - url
        parameters:
          type: object
          description: 视频处理参数。
          properties:
            resolution:
              type: string
              description: 生成视频的分辨率档位。默认值为 1080P。可选值：1080P、720P、480P
              default: 1080P
              enum:
                - 1080P
                - 720P
                - 480P
              example: 1080P
            ratio:
              type: string
              description: 生成视频的宽高比。可选值：adaptive（默认）、16:9、4:3、1:1、3:4、9:16
              default: adaptive
              enum:
                - adaptive
                - '16:9'
                - '4:3'
                - '1:1'
                - '3:4'
                - '9:16'
              example: adaptive
            duration:
              type: integer
              description: 生成视频的时长，单位为秒。取值范围[2, 30]的整数，或传 -1 智能时长模式。
              default: 5
              example: 10
            audio:
              type: boolean
              description: 输出视频是否包含音频。true：包含声音（默认），false：不包含音轨。
              default: true
              example: true
            seed:
              type: integer
              description: 随机种子，用于复现生成结果。取值范围：[0, 2147483647]。
              minimum: 0
              maximum: 2147483647
              example: 12345
            prompt_extend:
              type: boolean
              description: 是否开启 prompt 智能改写。true：开启（默认），false：不开启。
              default: true
              example: true
            watermark:
              type: boolean
              description: 是否添加水印标识。false：不添加（默认），true：添加。
              default: false
              example: false
      required:
        - model
        - input
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````