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

# Wan2.7 文生视频

> - WAN2.7 (wan2.7-text-to-video) 模型支持文生视频模式，基于文本提示词生成一段流畅的视频
- **多镜头叙事：** 通过 `prompt` 自然语言控制镜头结构
  - 单镜头：在提示词中说明「生成单镜头视频」
  - 多镜头：使用「生成多镜头视频」或时间戳分镜（如「第 1 个镜头 [0-3 秒] 全景：雨夜的街头」）
  - 默认：未指定时模型根据 `prompt` 内容自行理解
- **音频处理：**
  - 传入 `audio_urls`：模型以该音频为驱动源生成视频
  - 不传 `audio_urls`：模型根据视频画面内容自动生成匹配的背景音乐或音效
- 异步处理模式，使用返回的任务ID  [进行查询](/cn/api-manual/task-management/get-task-detail)
- 生成的视频链接，有效期为24小时，请尽快保存



## OpenAPI

````yaml cn/api-manual/video-series/wan2.7/wan2.7-text-to-video.json POST /v1/videos/generations
openapi: 3.1.0
info:
  title: wan2.7-text-to-video接口
  description: 使用WAN2.7模型进行文字生视频，支持简化的模型参数配置
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.evolink.ai
    description: 生产环境
security:
  - bearerAuth: []
paths:
  /v1/videos/generations:
    post:
      tags:
        - 视频生成
      summary: wan2.7-text-to-video接口
      description: >-
        - WAN2.7 (wan2.7-text-to-video) 模型支持文生视频模式，基于文本提示词生成一段流畅的视频

        - **多镜头叙事：** 通过 `prompt` 自然语言控制镜头结构
          - 单镜头：在提示词中说明「生成单镜头视频」
          - 多镜头：使用「生成多镜头视频」或时间戳分镜（如「第 1 个镜头 [0-3 秒] 全景：雨夜的街头」）
          - 默认：未指定时模型根据 `prompt` 内容自行理解
        - **音频处理：**
          - 传入 `audio_urls`：模型以该音频为驱动源生成视频
          - 不传 `audio_urls`：模型根据视频画面内容自动生成匹配的背景音乐或音效
        - 异步处理模式，使用返回的任务ID 
        [进行查询](/cn/api-manual/task-management/get-task-detail)

        - 生成的视频链接，有效期为24小时，请尽快保存
      operationId: createWan27TextToVideoGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Wan27TextToVideoRequest'
            examples:
              single_shot:
                summary: 单镜头文生视频
                value:
                  model: wan2.7-text-to-video
                  prompt: 一只小猫在月光下奔跑
                  aspect_ratio: '16:9'
                  duration: 5
              multi_shot_storyboard:
                summary: 多镜头分镜叙事
                value:
                  model: wan2.7-text-to-video
                  prompt: >-
                    一段紧张刺激的侦探追查故事。第 1 个镜头 [0-3 秒] 全景：雨夜的街头，霓虹闪烁。第 2 个镜头 [3-6 秒]
                    中景：侦探进入老旧建筑。第 3 个镜头 [6-9 秒] 特写：侦探眼神坚毅，远处传来警笛声。第 4 个镜头 [9-12
                    秒] 中景：昏暗走廊小心前行。第 5 个镜头 [12-15 秒] 特写：发现关键线索，恍然大悟。
                  aspect_ratio: '16:9'
                  duration: 15
              with_audio:
                summary: 传入驱动音频
                value:
                  model: wan2.7-text-to-video
                  prompt: 一只小巧可爱的卡通小猫将军身穿金色盔甲，骑着战马吟诵古诗
                  audio_urls:
                    - https://example.com/recital.mp3
                  duration: 10
              with_negative_prompt:
                summary: 使用反向提示词
                value:
                  model: wan2.7-text-to-video
                  prompt: 一只小猫在月光下奔跑
                  negative_prompt: 花朵
      responses:
        '200':
          description: 视频任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationResponse'
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_request
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未认证、Token无效或过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: unauthorized
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: 配额不足、需要充值
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: insufficient_quota
                  message: Insufficient quota. Please top up your account.
                  type: insufficient_quota
        '403':
          description: 无权限访问
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: model_access_denied
                  message: 'Token does not have access to model: wan2.7-text-to-video'
                  type: invalid_request_error
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: rate_limit_exceeded
                  message: Too many requests, please try again later
                  type: rate_limit_error
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: Internal server error
                  type: api_error
components:
  schemas:
    Wan27TextToVideoRequest:
      required:
        - model
        - prompt
      type: object
      properties:
        model:
          type: string
          description: 模型名称，固定为 `wan2.7-text-to-video`
          enum:
            - wan2.7-text-to-video
          example: wan2.7-text-to-video
        prompt:
          type: string
          description: |-
            视频生成的文本提示词。支持中英文，每个汉字/字母占 1 个字符，超过部分会自动截断，最大长度 5000 字符

            **多镜头叙事：** 通过自然语言控制镜头结构
            - 单镜头：在提示词中说明「生成单镜头视频」
            - 多镜头：使用「生成多镜头视频」或时间戳分镜（如「第 1 个镜头 [0-3 秒]」）
          maxLength: 5000
          example: 一只小猫在月光下奔跑
        negative_prompt:
          type: string
          description: 负面提示词，描述不希望在视频画面中出现的内容。支持中英文，最大长度 500 字符，超过部分会自动截断
          maxLength: 500
          example: 模糊, 低质量
        audio_urls:
          type: array
          items:
            type: string
            format: uri
          minItems: 1
          maxItems: 1
          description: |-
            驱动音频文件 URL 数组（可选）。**当前仅支持 1 个元素**

            **生效逻辑：**
            - 传入：模型以该音频为驱动源生成视频
            - 不传：模型根据画面内容自动生成匹配的背景音乐或音效

            **格式要求：**
            - 支持格式：`wav`、`mp3`
            - 时长范围：`2 ~ 30` 秒
            - 文件大小：不超过 `15MB`

            **截断处理：**
            - 若音频长度超过 `duration` 值，自动截取前 N 秒，其余部分丢弃
            - 若音频长度不足视频时长，超出音频长度部分为无声视频。例如：音频为 3 秒、视频时长为 5 秒，输出视频前 3 秒有声、后 2 秒无声
          example:
            - https://example.com/audio.mp3
        quality:
          type: string
          description: |-
            视频清晰度，默认为`720p`

            **说明：**
            - `720p`: 标准清晰度，标准价格，此为默认值
            - `1080p`: 高清晰度，价格会提升
          enum:
            - 720p
            - 1080p
          default: 720p
          example: 720p
        aspect_ratio:
          type: string
          description: >-
            视频宽高比，默认为 `16:9`


            **不同档位输出分辨率：**


            | 分辨率档位 | 16:9 | 9:16 | 1:1 | 4:3 | 3:4 |

            | --- | --- | --- | --- | --- | --- |

            | 720p | 1280×720 | 720×1280 | 960×960 | 1104×832 | 832×1104 |

            | 1080p | 1920×1080 | 1080×1920 | 1440×1440 | 1648×1248 | 1248×1648
            |
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
            - '4:3'
            - '3:4'
          default: '16:9'
          example: '16:9'
        duration:
          type: number
          description: |-
            视频时长（秒），范围 2-15

            **注意：**
            - 支持`2~15`秒之间的任意整数值
            - 实际扣费以生成视频的秒数为准
          minimum: 2
          maximum: 15
          default: 5
          example: 5
        seed:
          type: integer
          description: |-
            随机种子，默认随机

            **说明：**
            - 取值范围：`1` ~ `2147483647`
            - 固定 seed 可在调试 prompt 时降低参数变化的干扰，提升结果可复现性
          minimum: 1
          maximum: 2147483647
          example: 42
        prompt_extend:
          type: boolean
          description: |-
            是否开启prompt智能改写，开启后将使用大模型优化正向提示词，对描述性不足、较为简单的prompt提升效果较明显。

            **注意：** 默认值为 `false`，不传或传 `false` 时不会触发改写，如需开启请显式传 `true`
          default: false
          example: false
        callback_url:
          type: string
          description: |-
            任务完成后的HTTPS回调地址

            **回调时机：**
            - 任务完成（completed）、失败（failed）或取消（cancelled）时触发
            - 在计费确认完成后发送

            **安全限制：**
            - 仅支持HTTPS协议
            - 禁止回调到内网IP地址（127.0.0.1、10.x.x.x、172.16-31.x.x、192.168.x.x等）
            - URL长度不超过`2048`字符

            **回调机制：**
            - 超时时间：`10`秒
            - 失败后最多重试`3`次（会分别在失败的`1`秒/`2`秒/`4`秒后进行重试）
            - 回调响应体格式与任务查询接口返回的格式一致
            - 回调地址若返回2xx状态码视为成功，其他状态码会触发重试
          format: uri
          example: https://your-domain.com/webhooks/video-task-completed
    VideoGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: 任务创建时间戳
          example: 1757169743
        id:
          type: string
          description: 任务ID
          example: task-unified-1757169743-7cvnl5zw
        model:
          type: string
          description: 实际使用的模型名称
          example: wan2.7-text-to-video
        object:
          type: string
          enum:
            - video.generation.task
          description: 任务的具体类型
        progress:
          type: integer
          description: 任务进度百分比 (0-100)
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: 任务状态
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        task_info:
          $ref: '#/components/schemas/VideoTaskInfo'
          description: 视频任务详细信息
        type:
          type: string
          enum:
            - text
            - image
            - audio
            - video
          description: 任务的输出类型
          example: video
        usage:
          $ref: '#/components/schemas/Usage'
          description: 使用量和计费信息
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: 错误代码标识符
            message:
              type: string
              description: 错误描述信息
            type:
              type: string
              description: 错误类型
    VideoTaskInfo:
      type: object
      properties:
        can_cancel:
          type: boolean
          description: 任务是否可以取消
          example: true
        estimated_time:
          type: integer
          description: 预估完成时间（秒）
          minimum: 0
          example: 120
    Usage:
      type: object
      description: 使用量和计费信息
      properties:
        billing_rule:
          type: string
          description: 计费规则
          enum:
            - per_call
            - per_token
            - per_second
          example: per_call
        credits_reserved:
          type: number
          description: 预估消耗积分数
          minimum: 0
          example: 5
        user_group:
          type: string
          description: 用户组类别
          enum:
            - default
            - vip
          example: default
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需要使用Bearer Token进行认证##

        **获取 API Key ：**

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key

        **使用时在请求头中添加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````