# OpenAI/Sora2-T2V

Text-to-Video Model

## Asynchronous Task Submission

### API

`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/text-to-video`                                       |
| input.prompt        | string | Yes      | Prompt to guide the video generation                                                          |
| parameters.size     | string | No       | Size of the generated video. <br>Available resolutions: <br>- `720x1280`<br>- `1280x720`<br>Defaults to `720x1280` |
| parameters.duration | int    | No       | Duration of the generated video (in seconds), options are `4`, `8`, `12`, default is `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/text-to-video",
    "input": {
      "prompt": "A beautiful girl is dancing"
    },
    "parameters": {
      "size": "720x1280",
      "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"
}
```

## 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 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 | Execution duration of the task (in 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": ""
}
```