# Vidu/Text2Video

Text-to-Video Model

## Submit Asynchronous Task

### API

`https://api-us-ca.umodelverse.ai/v1/tasks/submit`

### Input

| Parameter                | Type    | Required | Description                                                                                           |
| :------------------------ | :------ | :------- | :--------------------------------------------------------------------------------------------------- |
| model                     | string  | Yes      | Model name, optional value: `viduq2`                                                                  |
| input.prompt              | string  | Yes      | Text prompt for video description generation, up to 2000 characters                                   |
| parameters.vidu_type      | string  | Yes      | Vidu interface type, in this case `text2video`                                                        |
| parameters.duration       | int     | No       | Video duration parameter, default value depends on the model: <br> - viduq2 : Default 5 seconds, optional: 1-10                                |
| parameters.seed           | int     | No       | Random seed, default 0 means using random numbers                                                    |
| parameters.aspect_ratio   | string  | No       | Aspect ratio, optional values: `16:9`, `9:16`, `3:4`, `4:3`, `1:1`, default `16:9`                   |
| parameters.resolution     | string  | No       | Resolution parameter, default value depends on the model and video duration: <br> - viduq2 (1-10 seconds): Default 720p, optional: 540p, 720p, 1080p |
| parameters.guidance_scale | float64 | No       | Guidance scale, controls the correlation between the generated result and the prompt                 |
| parameters.bgm            | bool    | No       | Whether to add background music, default `false`                                                     |

### Request Example

⚠️ If you are using a Windows system, it is recommended to use Postman or other API call tools.

```shell
curl --location --globoff 'https://api-us-ca.umodelverse.ai/v1/tasks/submit' \
--header 'Authorization: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "model": "viduq2",
    "input": {
      "prompt": "In an ultra-realistic fashion photography style featuring light blue and pale amber tones, an astronaut in a spacesuit walks through the fog. The background consists of enchanting white and golden lights, creating a minimalist still life and an impressive panoramic scene."
    },
    "parameters": {
      "vidu_type": "text2video",
      "duration": 5,
      "aspect_ratio": "16:9",
      "resolution": "720p",
      "bgm": true
    }
  }'
```

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

### API

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

### Request Example

```shell
curl --location 'https://api-us-ca.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 in case of failure         |
| usage.duration        | integer | Video 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": 1756959000,
    "finish_time": 1756959050
  },
  "usage": {
    "duration": 5
  },
  "request_id": ""
}
```