Video / Kling

Kling localized example text## Overview

Kling (Lip Sync)audiovideo in, video.supported video in images, and can audio and video.

Request can, will video, video.localized example text, localized example text「Billing」.

localized example textDescription
localized example texttask:task booking returntaskId, Pollingor
localized example textlocalized example text:()+ localized example text
Videomp4 / mov, exceeds 100MB, 2-60 seconds
Audiomp3 / wav / m4a, exceeds 5MB, after 2-60 seconds
localized example textsupported, first only supported

Base URL: https://mm-internal-cn.leonecloud.com ()

---## Authentication

with endpoint in Request in API Key:```
Authorization: Bearer {YOUR_API_KEY}


---

## Quick Start

**localized example text**
```bash

curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/kling-lipsync" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"videoUrl": "https://example.com/source-video.mp4",
"soundFile": "https://example.com/voice.wav",
"soundStartTime": 0,
"soundEndTime": 5000,
"soundInsertTime": 0
}'


**audio+ when+ localized example text**
```bash

curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/kling-lipsync" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"videoUrl": "https://example.com/source-video.mp4",
"soundFile": "https://example.com/voice.wav",
"soundStartTime": 2000,
"soundEndTime": 8000,
"soundInsertTime": 1500,
"soundVolume": 1.2,
"originalAudioVolume": 0.3
}'


>:audio number 2-8 seconds ( 6 seconds), video number 1.5 seconds; 1.2, video 0.3.

**Query Task**
```bash

curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/task_20261120174240_lhmic0g2" \
-H "Authorization: Bearer your_api_key_here"


---

## Endpoints

| Method | Path | localized example text|
|--------|------|------|
| POST | `/api/v2/open/aigc/kling-lipsync` | create task|
| GET | `/api/v2/open/aigc/{taskId}` | query task|
| POST | `/api/v2/open/aigc/batch` | Query Task (up to 100 )|
| GET | `/api/v2/open/balance` | Query Account Balance |

---

## Create Task

**POST** `/api/v2/open/aigc/kling-lipsync`

**Content-Type**: `application/json`

### Request Parameters

| Parameter | Type | Required | Description |
|------|------|------|------|
| videoUrl | string | localized example text| video, and`videoId` **localized example text** |
| videoId | string | localized example text| video ID, and`videoUrl` **localized example text** |
| faceId | string | No | localized example text.number images|
| soundFile | string | localized example text| audio, and`audioId` **localized example text** |
| audioId | string | localized example text| audio ID, and`soundFile` **localized example text** |
| soundStartTime | integer | **localized example text** | audio, seconds, audio.`0` localized example text|
| soundEndTime | integer | **localized example text** | audio, seconds, audio|
| soundInsertTime | integer | **localized example text** | after audiovideo when, seconds, video.`0` localized example text|
| soundVolume | number | No | audio, range 0-2, default 1.localized example text|
| originalAudioVolume | number | No | video, range 0-2, default 1.video no when Parameter no|
| callbackUrl | string | No | Callback notification URL after the task is complete |
| taskNickname | string | No | task, in|

### when Parameter (Required, )`soundStartTime` / `soundEndTime` / `soundInsertTime` **Required**, return ParameterError.Note `0` (), as 0 If omitted.

| localized example text| Description |
|------|------|
| after Duration| `soundEndTime - soundStartTime` mustin**2000-60000 seconds** (2-60 seconds)localized example text|
| localized example text| `soundStartTime` and`soundInsertTime` as|
| localized example text| audio when must and**can 2 seconds**, taskFailure|

**localized example text**

videocan,「can」localized example text.audioafter when (`soundInsertTime` localized example text`soundInsertTime + after Duration`)mustand with 2 seconds.: can video 1.0-9.0 seconds, audioafter 5 seconds.

| soundInsertTime | audiolocalized example text| localized example text| localized example text|
|-----------------|---------|------|------|
| 2000 | 2.0-7.0 seconds | 5 seconds | ✅ localized example text|
| 0 | 0-5.0 seconds | 4 seconds | ✅ localized example text|
| 8000 | 8.0-13.0 seconds | 1 seconds | ❌ 2 seconds|
| 10000 | 10.0-15.0 seconds | 0 seconds | ❌ localized example text|

> ⚠️ etc. complete after,**when**.localized example text「Billing」.

### asset Requirements| Type | Requirements |
|------|------|
| Video| mp4 / mov; exceeds 100MB; Duration 2-60 seconds; Resolutiononly supported 720p and 1080p; width and height in 512-2160px.with can|
| Audio | mp3 / wav / m4a; exceeds 5MB; after Duration 2-60 seconds|

### Response Parameters

| Parameter | Type | Description |
|------|------|------|
| code | int | Status Code, 0 indicates success |
| msg | string | Message |
| data.taskId | string | Task ID, used to query task status |
| data.status | string | Task Status, task bookingSuccessas`processing` |
| data.createdAt | string | Created Time |

### Response Example

**Success**
```json

{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261120174240_lhmic0g2",
"status": "processing",
"createdAt": "2026-11-20 17:42:40"
}
}


**ParameterError (video)**
```json

{
"code": 10002,
"msg": "videoUrl and videoId must",
"data": null
}


**ParameterError (when Parameter)**
```json

{
"code": 10002,
"msg": "soundStartTime / soundEndTime / soundInsertTime as Required",
"data": null
}


**ParameterError (after )**
```json

{
"code": 10002,
"msg": "after audioDuration 2 seconds",
"data": null
}


---

## Query Task Status

**GET** `/api/v2/open/aigc/{taskId}`

### Response Example

**in**
```json

{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261120174240_lhmic0g2",
"status": "processing",
"createdAt": "2026-11-20 17:42:40",
"updatedAt": "2026-11-20 17:43:05"
}
}


**Success**
```json

{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261120174240_lhmic0g2",
"status": "success",
"result": [
"https://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/2026/11/20/lipsync_001.mp4"
],
"createdAt": "2026-11-20 17:42:40",
"updatedAt": "2026-11-20 17:46:12"
}
}


**Failure**
```json

{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261120174240_lhmic0g2",
"status": "failed",
"errorMsg": "audiowhen and can 2 seconds ( can use 1000-9000 ms)",
"createdAt": "2026-11-20 17:42:40",
"updatedAt": "2026-11-20 17:43:28"
}
}


`status`:`processing` processing / `success` Success / `failed` Failure.

Failure:| errorMsg | recommended|
|----------|---------|
| videoin not can|, can Video|
| faceId in in| If omitted `faceId` number images, or|
| audiowhen and can 2 seconds| localized example text`errorMsg` can use`soundInsertTime` |

---

## Batch Query Task Status

**POST** `/api/v2/open/aigc/batch`

up to query 100 task.

---

## Callback Notification

Create Taskwhen`callbackUrl`, task(Success or Failure) will POST Request.

**Headers**

Content-Type: application/json
X-Funcloud-Event: task.completed
X-Funcloud-Signature: {localized example text}


**Body**
```json

{
"event": "task.completed",
"taskId": "task_20261120174240_lhmic0g2",
"status": "success",
"result": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/lipsync_001.mp4"],
"errorMsg": "",
"timestamp": "2026-11-20T17:46:12+08:00",
"signature": "a1b2c3d4e5f6..."
}


---

## Billing

**endpoint**, will:| localized example text| Billing Method | when|
|--------|---------|---------|
| localized example text| localized example text| taskwhen|
| localized example text| videoDuration|, when|

### ⚠️ in taskFailure when will, video.**execute will, Failure**.localized example text「, not」:

- videocan 
-`faceId` in 
- audio when and can 2 seconds, will, will.

**no**:first video in can, Duration and ResolutionRequirements; videorecommendedtask can use and when, `soundInsertTime`.

when, task after.localized example text.

---

## Error Codes

| code | Description |
|------|------|
| 0 | Success |
| 10002 | Parametermissing or malformed |
| 10005 | API Key invalid or missing |
| 30003 | Task not found |
| 40001 | Insufficient balance |
| 60001 | Model not|
| 90003 | Internal server error |

---

## Best Practices

### 1. Polling Strategy

- first 60 seconds:query every 5 seconds
- 60 seconds after:query every 10 seconds

recommendedCallback NotificationPolling.

### 2. and can use 

 or when when video, when「2 seconds」.recommended, Failure can use, when——,.

### 3. audioand video when 

- when Parameter**seconds**as, seconds.
- `soundStartTime` / `soundEndTime` localized example text**audiolocalized example text**; `soundInsertTime` localized example text**videolocalized example text**, localized example text.
- after audiovideoDuration.

### 4. recommended

- video with music when,`originalAudioVolume` 0.2-0.4, localized example text.
- video, recommended`originalAudioVolume` as 0, in.
Updated 2026-11-20