# Kling/O1

Full Video Generation Model

## Submit Task (Asynchronous)

### Endpoint

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

### Input

| Parameter                | Type   | Required | Description |
| :----------------------- | :----- | :------- | :---------- |
| model                    | string | Yes      | Model name, here it is `kling-video-o1` |
| input.prompt             | string | Yes      | Prompt used to guide video generation |
| parameters.mode          | string | No       | Generation mode. Available values: `std`, `pro`. Default is `pro`. Currently only `pro` is supported |
| parameters.aspect_ratio  | string | No       | Video aspect ratio. Available values: `16:9`, `9:16`, `1:1` |
| parameters.duration      | int    | No       | Video duration (seconds). Available values: `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`. Default is `5` <br>When using text-to-video or first-frame image-to-video, only 5s and 10s are supported<br>When using video editing (`"refer_type": "base"`), the output duration matches the input video duration, and this parameter becomes invalid; billing is calculated based on the rounded duration of the input video |
| parameters.image_list    | array  | No       | Image list used to specify the first or last frame of the video. Each item includes:<br>- `image_url`: image URL or Base64 encoded string<br>- `type`: image type, available values: `first_frame`, `end_frame` |
| parameters.video_list    | array  | No       | Video list used for reference or editing. Each item includes:<br>- `video_url`: video URL<br>- `refer_type`: reference type, available values: `feature` (feature reference), `base` (to be edited)<br>- `keep_original_sound`: whether to keep original sound, available values: `yes`, `no` |
| parameters.element_list  | array  | No       | Subject reference list <br>- Configured using subject IDs from the subject library, structured as key:value pairs, as follows:<br>"element_list":[<br>{<br>"element_id": long<br>}<br>]<br>- The number of subject references depends on whether reference videos/images are provided:<br>- If a reference video exists, the total number of reference images and subjects must not exceed 4;<br>- If no reference video exists, the total number must not exceed 7 |

**Note**:
- The O1 model does not support custom subject-related features (`element_list`). Contact technical support if needed.

### Request Example

⚠️ If you are using Windows, it is recommended to use Postman or other API 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": "kling-video-o1",
    "input": {
      "prompt": "A beautiful sunset over the ocean with waves gently crashing"
    },
    "parameters": {
      "mode": "pro",
      "aspect_ratio": "16:9",
      "duration": 5,
      "image_list": [
        {
          "image_url": "https://example.com/first_frame.jpg",
          "type": "first_frame"
        }
      ]
    }
  }'
```

### Output

| Parameter      | Type   | Description                         |
| :------------- | :----- | :---------------------------------- |
| output.task_id | string | Unique identifier of the async task |
| request_id     | string | Unique identifier of the request    |

### Response Example

```json
{
  "output": {
    "task_id": "task_id"
  },
  "request_id": "request_id"
}
```

## Query 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 of the async task                     |
| output.task_status   | string  | Task status: `Pending`, `Running`, `Success`, `Failure` |
| output.urls          | array   | List of video result URLs                               |
| output.submit_time   | integer | Task submission timestamp                               |
| output.finish_time   | integer | Task completion timestamp                               |
| output.error_message | string  | Error message returned when failed                      |
| usage.duration       | integer | Video duration (seconds)                                |
| request_id           | string  | Unique identifier of the request                        |

### Response Example (Success)

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

### Response Example (Failure)

```json
{
  "output": {
    "task_id": "task_id",
    "task_status": "Failure",
    "submit_time": 1756959000,
    "finish_time": 1756959019,
    "error_message": "error_message"
  },
  "usage": {
    "duration": 5
  },
  "request_id": ""
}
```
