# Wan-AI/Wan2.2-T2V

Text-to-Video Model

## Asynchronous Task Submission

### Endpoint

`https://api.umodelverse.ai/v1/tasks/submit`

### Input

| Parameter             | Type   | Required | Description                                                                                                    |
| :-------------------- | :----- | :------- | :------------------------------------------------------------------------------------------------------------- |
| model                 | string | Yes      | Model name, here it is `Wan-AI/Wan2.2-T2V`                                                                     |
| input.prompt          | string | Yes      | Prompts used for describing the content of the video to be generated                                           |
| input.negative_prompt | string | No       | Negative prompts used to restrict unwanted content                                                             |
| parameters.size       | string | No       | Output size, when the resolution is set to 480P, sizes supported are `832x480, 480x832`<br>When set to 720P, sizes supported are `1280x720, 720x1280` |
| parameters.resolution | string | No       | Resolution level of the video generation, currently only supports `720P`, `480P`                               |
| parameters.duration   | int    | No       | Video generation duration (seconds), supports `5` `8`                                                          |
| parameters.seed       | int    | No       | Random number seed, range `[0, 2147483647]`                                                                    |

### Example Request
⚠️ If you are using Windows, it is recommended to use Postman or another API calling tool.
```shell
curl --location --globoff 'https://api.umodelverse.ai/v1/tasks/submit' \
--header 'Authorization: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "model": "Wan-AI/Wan2.2-T2V",
    "input": {
      "prompt": "a beautiful flower",
      "negative_prompt": "low quality"
    },
    "parameters": {
      "resolution": "720P",
      "seed": 12345
    }
  }'
```

### Output

| Parameter      | Type   | Description            |
| :------------- | :----- | :--------------------- |
| output.task_id | string | Unique identifier for the asynchronous task |
| request_id     | string | Unique identifier for the request |

### Response Example

```json
{
  "output": {
    "task_id": "task_id"
  },
  "request_id": "request_id"
}
```

## Query Task Status

### Endpoint

`https://api.umodelverse.ai/v1/tasks/status?task_id=<task_id>`

### Example Request

```shell
curl --location 'https://api.umodelverse.ai/v1/tasks/status?task_id=<task_id>' \
--header 'Authorization: <YOUR_API_KEY>' \
```

### Output

| Parameter             | Type    | Description                                             |
| :-------------------  | :------ | :------------------------------------------------------ |
| output.task_id        | string  | Unique identifier for the asynchronous task             |
| output.task_status    | string  | Task status: `Pending`,`Running`,`Success`,`Failure`    |
| output.urls           | array   | List of URLs for the video results                      |
| output.submit_time    | integer | Task submission timestamp                               |
| output.finish_time    | integer | Task completion timestamp                               |
| output.error_message  | string  | Error message returned when the task fails              |
| usage.duration        | integer | Task execution duration (seconds)                       |
| request_id            | string  | Unique identifier for the request                       |

### Response Example

```json
{
  "output": {
    "task_id": "task_id",
    "task_status": "Success",
    "urls": ["https://xxxxx/xxxx.mp4"],
    "submit_time": 1756958375,
    "finish_time": 1756958428
  },
  "usage": {
    "duration": 5
  },
  "request_id": "request_id"
}
```