# OpenAI/Sora2-I2V-Pro

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, `openai/sora-2/image-to-video-pro`         |
| input.first_frame_url | string | Yes      | First frame image URL for the video, can be a URL or Base64          |
| input.prompt          | string | No       | Prompt used to guide the video generation                            |
| parameters.resolution | string | No       | Resolution for the generated video. <br>Options: <br>- `720p`<br>- `1080p`<br>Defaults to `720p` |
| parameters.duration   | int    | No       | Video generation duration (seconds), options are `4`, `8`, `12`, defaults to `4` |

### 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": "openai/sora-2/image-to-video-pro",
    "input": {
      "first_frame_url": "https://umodelverse-inference.cn-wlcb.ufileos.com/ucloud-maxcot.jpg",
      "prompt": "The image is coming to life"
    },
    "parameters": {
      "resolution": "720p",
      "duration": 4
    }
  }'
```

### 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 the video result                        |
| output.submit_time   | integer | Timestamp when the task was submitted                   |
| output.finish_time   | integer | Timestamp when the task was completed                   |
| output.error_message | string  | Error message returned in case of 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": 4
  },
  "request_id": ""
}
```