# Wan-AI/Wan2.2-I2V

Image-to-Video Model

## Asynchronous Task Submission

### Endpoint

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

### Input

| Parameter             | Type   | Required | Description                                    |
| :-------------------- | :----- | :------- | :--------------------------------------------- |
| model                 | string | Yes      | Model name, in this case `Wan-AI/Wan2.2-I2V`   |
| input.first_frame_url | string | Yes      | URL of the first frame image, can be URL or Base64 |
| input.last_frame_url  | string | No       | URL of the last frame image, can be URL or Base64 |
| input.prompt          | string | Yes      | Prompts to guide video generation              |
| input.negative_prompt | string | No       | Negative prompts to restrict unwanted content  |
| parameters.resolution | string | No       | Video resolution level, currently supports `720P`, `480P` |
| parameters.duration   | int    | No       | Video generation duration (seconds), supports `5` or `8` |
| parameters.seed       | int    | No       | Random number seed, range `[0, 2147483647]`    |

### 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": "Wan-AI/Wan2.2-I2V",
    "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": "Convert to quick pencil sketch"
    },
    "parameters": {
      "resolution": "720P"
    }
  }'
```

### 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"
}
```

## Check Task Status

### Endpoint

`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 | Duration of task execution (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": ""
}
```