# Wan2.7 文生视频任务状态

> 视频生成

查询异步任务状态。任务完成后，响应中会包含结果 URL、用量信息或错误信息。

## 请求地址

`GET https://api.modelverse.cn/v1/tasks/status`

## 请求参数

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| task_id | query | string | Yes | 由 `/v1/tasks/submit` 返回的异步任务标识符。 |

## 响应

- **200** — 任务状态响应。
- **400** — 请求参数无效。
- **default** — 错误响应。

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "wan2.7-t2v接口文档",
    "version": "1.0.0",
    "description": "这是 ModelVerse 上 `wan2.7-t2v` 的文生视频接口文档，说明如何提交生成任务、查询任务状态、读取视频结果以及处理错误。\n接口路径包括 `POST /v1/tasks/submit`、`GET /v1/tasks/status`。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "该模型文档中使用的 ModelVerse API 端点。"
    }
  ],
  "tags": [
    {
      "name": "wan2.7-t2v",
      "description": "Text-to-video asynchronous task operations."
    }
  ],
  "paths": {
    "/v1/tasks/submit": {
      "post": {
        "tags": [
          "wan2.7-t2v"
        ],
        "operationId": "submitWan27T2VTask",
        "summary": "Wan2.7 文生视频",
        "description": "提交异步任务。请求体中的模型和参数按本模型文档填写，响应会返回任务 ID。\nWan2.7-T2V 支持从文本生成流畅、高质量的视频。\n支持音频驱动:可通过提供音频文件让视频中的人物动作与音频节奏同步。\n文生视频任务需要 1-5 分钟，API 使用异步调用。\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Wan27T2VSubmitRequest"
              },
              "examples": {
                "textToVideo": {
                  "summary": "提交文生视频任务",
                  "value": {
                    "model": "wan2.7-t2v",
                    "input": {
                      "prompt": "A beautiful girl is dancing in the moonlight"
                    },
                    "parameters": {
                      "resolution": "720P",
                      "ratio": "16:9",
                      "duration": 5,
                      "prompt_extend": true,
                      "watermark": true
                    }
                  }
                },
                "withAudio": {
                  "summary": "带音频引导的文生视频任务",
                  "value": {
                    "model": "wan2.7-t2v",
                    "input": {
                      "prompt": "A kitten general wearing golden armor, saying war poems",
                      "audio_url": "https://example.com/audio.mp3"
                    },
                    "parameters": {
                      "resolution": "1080P",
                      "ratio": "16:9",
                      "duration": 10,
                      "prompt_extend": true
                    }
                  }
                },
                "withNegativePrompt": {
                  "summary": "带负面提示词的文生视频任务",
                  "value": {
                    "model": "wan2.7-t2v",
                    "input": {
                      "prompt": "A kitten running in the moonlight",
                      "negative_prompt": "flower, blurry, low quality"
                    },
                    "parameters": {
                      "resolution": "720P",
                      "ratio": "16:9",
                      "duration": 5
                    }
                  }
                },
                "multiShot": {
                  "summary": "多镜头叙事视频任务",
                  "value": {
                    "model": "wan2.7-t2v",
                    "input": {
                      "prompt": "Shot 1 [0-3 seconds] wide shot: Rainy New York street. Shot 2 [3-6 seconds] medium shot: Detective enters building."
                    },
                    "parameters": {
                      "resolution": "1080P",
                      "ratio": "16:9",
                      "duration": 15,
                      "prompt_extend": true,
                      "watermark": true
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务提交成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wan27T2VSubmitResponse"
                },
                "examples": {
                  "submitted": {
                    "summary": "已提交任务",
                    "value": {
                      "output": {
                        "task_id": "task_xxxxxxxxxxxxx",
                        "task_status": "PENDING"
                      },
                      "request_id": "req_xxxxxxxxxxxxx"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wan27T2VErrorResponse"
                },
                "examples": {
                  "paramError": {
                    "$ref": "#/components/examples/Wan27T2VParamError"
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wan27T2VErrorResponse"
                },
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/Wan27T2VParamError"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/status": {
      "get": {
        "tags": [
          "wan2.7-t2v"
        ],
        "operationId": "getWan27T2VTaskStatus",
        "summary": "Wan2.7 文生视频任务状态",
        "description": "查询异步任务状态。任务完成后，响应中会包含结果 URL、用量信息或错误信息。\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "task_id",
            "in": "query",
            "required": true,
            "description": "由 `/v1/tasks/submit` 返回的异步任务标识符。",
            "schema": {
              "type": "string"
            },
            "examples": {
              "placeholder": {
                "summary": "源文档占位值",
                "value": "task_xxxxxxxxxxxxx"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "任务状态响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wan27T2VStatusResponse"
                },
                "examples": {
                  "success": {
                    "summary": "成功任务",
                    "value": {
                      "output": {
                        "task_id": "task_xxxxxxxxxxxxx",
                        "task_status": "SUCCEEDED",
                        "urls": [
                          "https://xxxxx/xxxx.mp4"
                        ],
                        "submit_time": 1756959000,
                        "finish_time": 1756959050
                      },
                      "usage": {
                        "duration": 5
                      },
                      "request_id": "req_xxxxxxxxxxxxx"
                    }
                  },
                  "failure": {
                    "summary": "失败任务",
                    "value": {
                      "output": {
                        "task_id": "task_id",
                        "task_status": "Failure",
                        "submit_time": 1756959000,
                        "finish_time": 1756959019,
                        "error_message": "error_message"
                      },
                      "usage": {
                        "duration": 5
                      },
                      "request_id": ""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "请求参数无效。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wan27T2VErrorResponse"
                },
                "examples": {
                  "paramError": {
                    "$ref": "#/components/examples/Wan27T2VParamError"
                  }
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wan27T2VErrorResponse"
                },
                "examples": {
                  "error": {
                    "$ref": "#/components/examples/Wan27T2VParamError"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "API Key 认证。请在请求头中携带 `Authorization: Bearer {your_api_key}`。\n"
      }
    },
    "schemas": {
      "Wan27T2VSubmitRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "wan2.7-t2v",
            "description": "模型名称。此文档固定为 `wan2.7-t2v`。"
          },
          "input": {
            "$ref": "#/components/schemas/Wan27T2VInput"
          },
          "parameters": {
            "$ref": "#/components/schemas/Wan27T2VParameters"
          }
        }
      },
      "Wan27T2VInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prompt"
        ],
        "properties": {
          "prompt": {
            "type": "string",
            "description": "用于指导视频生成的文本提示词。描述视频内容和视觉风格。\n支持中文和英文。最多 5000 字符，超出部分自动截断。\n"
          },
          "negative_prompt": {
            "type": "string",
            "description": "负面提示词，指定不希望在生成视频中出现的元素。\n支持中文和英文。最多 500 字符。\n例如: low resolution, error, worst quality, deformed, extra fingers\n"
          },
          "audio_url": {
            "type": "string",
            "format": "uri",
            "description": "音频文件 URL，用于驱动视频生成。\n支持格式: WAV, MP3\n时长: 2-30 秒\n文件大小: 最大 15 MB\n注意: 如音频时长超过视频时长，仅使用前半部分；如短于视频，剩余部分静音。\n"
          }
        }
      },
      "Wan27T2VParameters": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "resolution": {
            "type": "string",
            "description": "生成视频的分辨率等级。不同的分辨率会影响价格和生成质量。\n",
            "enum": [
              "720P",
              "1080P"
            ],
            "default": "1080P"
          },
          "ratio": {
            "type": "string",
            "description": "输出视频的宽高比。\n720P 16:9 输出 1280*720\n720P 9:16 输出 720*1280\n720P 1:1 输出 960*960\n720P 4:3 输出 1104*832\n720P 3:4 输出 832*1104\n1080P 16:9 输出 1920*1080\n1080P 9:16 输出 1080*1920\n1080P 1:1 输出 1440*1440\n1080P 4:3 输出 1648*1248\n1080P 3:4 输出 1248*1648\n",
            "enum": [
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4"
            ],
            "default": "16:9"
          },
          "duration": {
            "type": "integer",
            "description": "生成视频的时长，单位为秒。按秒计费。\n取值范围: 2-15 秒\n",
            "enum": [
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15
            ],
            "default": 5
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647,
            "description": "随机种子。取值范围 [0, 2147483647]。\n不指定时随机生成。固定种子可提高可重复性，但不保证完全相同的结果。\n"
          },
          "prompt_extend": {
            "type": "boolean",
            "description": "是否启用智能提示词扩写。开启后大模型会重写输入提示词以改善生成质量。\n适合短提示词，但会增加延迟。\n",
            "default": true
          },
          "watermark": {
            "type": "boolean",
            "description": "是否在生成视频右下角添加 \"AI Generated\" 水印。\n",
            "default": false
          }
        }
      },
      "Wan27T2VSubmitResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "output",
          "request_id"
        ],
        "properties": {
          "output": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "task_id",
              "task_status"
            ],
            "properties": {
              "task_id": {
                "type": "string",
                "description": "异步任务唯一标识。有效期 24 小时。"
              },
              "task_status": {
                "type": "string",
                "description": "任务状态。",
                "enum": [
                  "PENDING",
                  "RUNNING",
                  "SUCCEEDED",
                  "FAILED",
                  "CANCELED",
                  "UNKNOWN"
                ]
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "唯一请求标识。"
          }
        }
      },
      "Wan27T2VStatusResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "output",
          "request_id"
        ],
        "properties": {
          "output": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "task_id",
              "task_status"
            ],
            "properties": {
              "task_id": {
                "type": "string",
                "description": "异步任务唯一标识。"
              },
              "task_status": {
                "$ref": "#/components/schemas/Wan27T2VTaskStatus"
              },
              "urls": {
                "type": "array",
                "description": "视频结果 URL 列表。",
                "items": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "submit_time": {
                "type": "integer",
                "format": "int64",
                "description": "任务提交时间的 Unix 秒级时间戳。"
              },
              "finish_time": {
                "type": "integer",
                "format": "int64",
                "description": "任务完成时间的 Unix 秒级时间戳。"
              },
              "error_message": {
                "type": "string",
                "description": "任务失败时返回的错误信息。"
              }
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "duration": {
                "type": "integer",
                "description": "视频输出时长，单位为秒。"
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "唯一请求标识。"
          }
        }
      },
      "Wan27T2VStatusOutput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "task_id",
          "task_status"
        ],
        "properties": {
          "task_id": {
            "type": "string",
            "description": "异步任务唯一标识。"
          },
          "task_status": {
            "$ref": "#/components/schemas/Wan27T2VTaskStatus"
          },
          "urls": {
            "type": "array",
            "description": "视频结果 URL 列表。",
            "items": {
              "type": "string",
              "format": "uri"
            }
          },
          "submit_time": {
            "type": "integer",
            "format": "int64",
            "description": "任务提交时间的 Unix 秒级时间戳。"
          },
          "finish_time": {
            "type": "integer",
            "format": "int64",
            "description": "任务完成时间的 Unix 秒级时间戳。"
          },
          "error_message": {
            "type": "string",
            "description": "任务失败时返回的错误信息。"
          }
        }
      },
      "Wan27T2VTaskStatus": {
        "type": "string",
        "description": "异步任务状态。\n- PENDING: 等待处理\n- RUNNING: 正在处理\n- SUCCEEDED: 任务成功完成\n- FAILED: 任务失败\n- CANCELED: 任务已取消\n- UNKNOWN: 任务不存在或状态未知\n状态流转: PENDING → RUNNING → SUCCEEDED 或 FAILED\n",
        "enum": [
          "PENDING",
          "RUNNING",
          "SUCCEEDED",
          "FAILED",
          "CANCELED",
          "UNKNOWN"
        ]
      },
      "Wan27T2VUsage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "duration": {
            "type": "integer",
            "description": "视频输出时长，单位为秒。"
          }
        }
      },
      "Wan27T2VErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Wan27T2VErrorObject"
          },
          "request_id": {
            "type": "string",
            "description": "唯一请求标识，如可用。"
          }
        }
      },
      "Wan27T2VErrorObject": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "错误信息。"
          },
          "type": {
            "type": "string",
            "description": "错误类型。",
            "examples": [
              "invalid_request_error"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "错误码。",
            "examples": [
              "InvalidApiKey",
              "InvalidParameter"
            ]
          },
          "param": {
            "type": [
              "string",
              "null"
            ],
            "description": "相关请求参数，如有。"
          }
        }
      }
    },
    "examples": {
      "Wan27T2VParamError": {
        "summary": "参数错误",
        "value": {
          "error": {
            "message": "Invalid param",
            "type": "invalid_request_error",
            "code": "InvalidParameter",
            "param": "parameters.resolution"
          },
          "request_id": "req_xxxxxxxxxxxxx"
        }
      }
    }
  }
}
```
