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

# Wan 文生视频

> 当前项目已实现 Ali `wan2.7-t2v`。提交任务后，请通过 `GET /v1/videos/{task_id}` 查询状态。

公开字段：`model`、`prompt`、`seconds`、`size`、`prompt_extend`、`watermark`、`seed`、`negative_prompt`。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelVideo/ali/text-to-video.json POST /v1/videos
openapi: 3.0.1
info:
  title: Wan 文生视频
  version: 1.0.0
  description: Wan 系列文生视频能力文档。公开统一入口为 `/v1/videos`，用于创建异步视频生成任务。
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API 服务地址
security: []
tags:
  - name: Wan Video
    description: Wan 文生视频能力
paths:
  /v1/videos:
    post:
      tags:
        - Wan Video
      summary: wan2.7-t2v 文生视频
      description: >-
        当前项目已实现 Ali `wan2.7-t2v`。提交任务后，请通过 `GET /v1/videos/{task_id}` 查询状态。


        公开字段：`model`、`prompt`、`seconds`、`size`、`prompt_extend`、`watermark`、`seed`、`negative_prompt`。
      operationId: aliTextToVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextToVideoRequest'
            examples:
              text_to_video:
                summary: 基础文生视频请求
                value:
                  model: wan2.7-t2v
                  prompt: 写实风格，一只黑色小猫好奇地看向天空，镜头从平视逐渐上升。
                  seconds: '5'
                  size: 1080P
      responses:
        '200':
          description: 提交成功，返回视频任务对象。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoTaskResponse'
        '400':
          description: 请求参数不合法。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: 参数错误
                  value:
                    error:
                      message: 请求体格式错误或字段取值非法
                      type: invalid_request_error
                      code: bad_request_body
                      param: ''
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: 未授权
                  value:
                    error:
                      message: 无效的令牌
                      type: api_error
                      code: access_denied
                      param: ''
          description: 鉴权失败，例如未提供令牌或令牌无效。
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                request_too_large:
                  summary: 请求体过大
                  value:
                    error:
                      message: 请求体过大，请缩小输入后重试
                      type: api_error
                      code: read_request_body_failed
                      param: ''
          description: 请求体过大。
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quota_exceeded:
                  summary: 额度不足或速率受限
                  value:
                    error:
                      message: 当前账户额度不足，请稍后重试
                      type: api_error
                      code: insufficient_user_quota
                      param: ''
          description: 触发速率限制或账户额度不足。
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: 内部处理失败
                  value:
                    error:
                      message: 服务内部处理失败，请稍后重试
                      type: api_error
                      code: gen_relay_info_failed
                      param: ''
          description: 服务端处理请求时发生内部错误。
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                bad_gateway:
                  summary: 上游响应异常
                  value:
                    error:
                      message: 上游服务返回了无效响应
                      type: api_error
                      code: bad_response_status_code
                      param: ''
          description: 上游服务返回异常响应。
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                service_unavailable:
                  summary: 服务暂不可用
                  value:
                    error:
                      message: 当前模型暂时无可用渠道，请稍后重试
                      type: api_error
                      code: get_channel_failed
                      param: ''
          description: 上游服务暂不可用，或当前模型暂无可用渠道。
      security:
        - BearerAuth: []
components:
  schemas:
    TextToVideoRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          enum:
            - wan2.7-t2v
          description: 模型名称。可选值：`wan2.7-t2v`。
        prompt:
          type: string
          description: |-
            文本提示词。用来描述生成视频中期望包含的元素和视觉特点。支持中英文，每个汉字/字母占一个字符，超过部分会自动截断。

            - `wan2.7-t2v`：不超过5000个字符。
        seconds:
          type: string
          description: |-
            **重要**
            `seconds` 直接影响费用，请在调用前确认模型价格。

            生成视频的时长，单位为秒。
            - `wan2.7-t2v`：取值为 [2, 15] 之间的整数。默认值为5。
          default: '5'
          enum:
            - '2'
            - '3'
            - '4'
            - '5'
            - '6'
            - '7'
            - '8'
            - '9'
            - '10'
            - '11'
            - '12'
            - '13'
            - '14'
            - '15'
        size:
          type: string
          enum:
            - 720P
            - 1080P
          description: |-
            **重要**
            `size` 直接影响费用，请在调用前确认模型价格。

            生成视频的分辨率档位，用于控制视频的清晰度（总像素）。

            `wan2.7-t2v`：可选值：`720P`、`1080P`。默认值为 `1080P`。
          default: 1080P
        prompt_extend:
          type: boolean
          description: >-
            是否开启 prompt 智能改写。开启后使用大模型对输入 prompt 进行智能改写。对于较短的 prompt
            生成效果提升明显，但会增加耗时。

            - `true`（默认值）：开启智能改写。

            - `false`：不开启智能改写。
          default: false
        watermark:
          type: boolean
          description: |-
            是否添加水印标识，水印位于视频右下角，文案固定为 "AI生成"。
            - `false`（默认值）：不添加水印。
            - `true`：添加水印。
          default: false
        seed:
          type: integer
          description: >-
            随机数种子，取值范围为 [0, 2147483647]。未指定时，系统自动生成随机种子。若需提升生成结果的可复现性，建议固定 seed
            值。请注意，由于模型生成具有概率性，即使使用相同 seed，也不能保证每次生成结果完全一致。
        negative_prompt:
          type: string
          description: |-
            反向提示词，用来描述不希望在视频画面中看到的内容，可以对视频画面进行限制。支持中英文，长度不超过500个字符，超过部分会自动截断。

            示例值：低分辨率、错误、最差质量、低质量、残缺、多余的手指、比例不良等。
    VideoTaskResponse:
      type: object
      properties:
        id:
          type: string
          description: 任务唯一标识。
        task_id:
          type: string
          description: 任务 ID（与 id 相同）。
        object:
          type: string
          example: video
        model:
          type: string
          description: 使用的模型名称。
        status:
          type: string
          enum:
            - pending
            - queued
            - running
            - succeeded
            - failed
            - cancelled
          description: 任务状态。
        progress:
          type: integer
          description: 任务进度（百分比）。
        created_at:
          type: integer
          format: int64
          description: 创建时间的 Unix 时间戳（秒）。
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: 错误类型，例如 `invalid_request_error`、`api_error` 或上游兼容错误类型。
            code:
              type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````