# Vidu/Start-to-End Video Generation

vidu Start-to-End Video Generation API Documentation

## Asynchronous Task Submission

### API

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

### Input

| Parameter                     | Type   | Required | Description                                                                                                                                                                         |
| :---------------------------- | :----- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| model                         | string | Yes      | Model name, options: `viduq2-pro`, `viduq2-turbo`  <br> - viduq2-pro: New model, excellent effect, rich in detail <br> - viduq2-turbo: New model, excellent effect, fast generation   |
| input.first_frame_url         | string | Yes      | First frame image, supports image URL or Base64 encoding                                                                                                                            |
| input.last_frame_url          | string | Yes      | Last frame image, supports image URL or Base64 encoding                                                                                                                             |
| input.prompt                  | string | No       | Text prompt for guiding video generation, up to 2000 characters.                                                                                                                    |
| parameters.vidu_type          | string | Yes      | Vidu API type, here it should be `start-end2video`                                                                                                                                  |
| parameters.duration           | int    | No       | Video duration parameter, default depends on the model: <br> - viduq2-pro defaults to 5, options: 1, 2, 3, 4, 5, 6, 7, 8  <br> - viduq2-turbo defaults to 5, options: 1, 2, 3, 4, 5, 6, 7, 8 |
| parameters.seed               | int    | No       | Random seed, default 0 means using random number                                                                                                                                    |
| parameters.resolution         | string | No       | Resolution parameter, default depends on model and video duration: <br> - viduq2-pro 1-8s: default 720p, options: 540p, 720p, 1080p <br> - viduq2-turbo 1-8s: default 720p, options: 540p, 720p, 1080p |
| parameters.movement_amplitude | string | No       | Movement amplitude, options: `auto`, `small`, `medium`, `large`, default `auto`                                                                                                     |
| parameters.bgm                | bool   | No       | Whether to add background music, default `false`                                                                                                                                    |

**Note:**
- Both `first_frame_url` and `last_frame_url` parameters must be provided
- The resolutions of the first and last frame images should be similar, the ratio should be between 0.8 and 1.25
- Supported image formats are png, jpeg, jpg, webp
- Image aspect ratio needs to be less than 1:4 or 4:1
- Image size should not exceed 50 MB
- Base64 encoding format example: `data:image/png;base64,{base64_encode}`

### Request Example

⚠️ If you are using a Windows system, it is recommended to use Postman or other API calling 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-pro",
    "input": {
      "first_frame_url": "https://umodelverse-inference.cn-wlcb.ufileos.com/ucloud-maxcot.jpg",
      "last_frame_url": "https://umodelverse-inference.cn-wlcb.ufileos.com/ucloud-maxcot.jpg",
      "prompt": "Continue the video with smooth camera movement."
    },
    "parameters": {
      "vidu_type": "start-end2video",
      "duration": 5,
      "resolution": "1080p",
      "movement_amplitude": "auto",
      "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 video results                      |
| output.submit_time   | integer | Timestamp of task submission                        |
| output.finish_time   | integer | Timestamp of task completion                        |
| output.error_message | string  | Error message returned on 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": ""
}
```