Apply Lip Sync to Video
April 18, 2025
Table of contents
This endpoint applies lip sync to a video using an audio file, making the character in the video appear to speak the audio.
Video cannot be longer than 10 seconds.
We suggest using PixVerse Lip Sync POST pixverse/videos/lipsync for longer videos. PixVerse can lip sync videos up to 60 seconds long and has much more relaxed requirements for character face visibility.
https://api.useapi.net/v1/kling/videos/lipsync
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"email": "[email protected]",
"video": "https://example.com/video.mp4",
"audio": "https://example.com/audio.mp3",
"replyUrl": "https://your-callback-url.com/webhook",
"replyRef": "your-reference-id"
}
-
email
is optional when only one account configured.
However, if you have multiple accounts configured, this parameter becomes required. -
video
is required, URL to the video that contains a face to sync with.
Video cannot be longer than 10 seconds.
Video can be uploaded using POST /assets and the returned URL can be used here. -
audio
is required, URL to the audio file containing speech.
Audio can be uploaded using POST /assets and the returned URL can be used here. -
maxJobs
is optional, range from1
to10
.
Specifies the maximum number of concurrent jobs. -
replyUrl
is optional, a callback URL to receive generation progress and result.
See GET /tasks/task_id
for response model. -
replyRef
is optional, a reference identifier for the callback.
Notes:
- The video should contain a clear frontal view of a face with lip movements.
- Supported audio formats include MP3, WAV, and other common audio formats.
- If the audio is shorter than the video, the excess video will be muted. If it’s longer, the excess audio will be discarded.
Responses
-
{ "task": { "id": 123456789, "userId": 12345, "type": "m2v_video_lip_sync", "scene": "NORMAL_CREATION", "status": 5, "status_name": "submitted", "status_final": false, "taskInfo": { "type": "m2v_video_lip_sync", "inputs": [ { "name": "video", "inputType": "URL", "token": null, "blobStorage": null, "url": "https://example.com/video.mp4", "cover": null, "fromWorkId": null }, { "name": "audio", "inputType": "URL", "token": null, "blobStorage": null, "url": "https://example.com/audio.mp3", "cover": null, "fromWorkId": null } ], "arguments": [ { "name": "__filename", "value": "audio.mp3" }, { "name": "__isLocalAudio", "value": "true" }, { "name": "biz", "value": "klingai" } ], "extraArgs": {}, "callbackPayloads": [], "scene": "NORMAL_CREATION" }, "favored": false, "deleted": false, "viewed": false, "createTime": 1745376611075, "updateTime": 1745376611075 }, "works": [], "status": 5, "status_name": "submitted", "status_final": false, "message": "", "limitation": { "type": "m2v_video_lip_sync", "remaining": 10000, "limit": 10000 }, "userPoints": { "points": [], "total": 0 }, "userTickets": { "ticket": [] }, "editProject": null }
-
{ "error": "Parameter video is required" }
-
{ "error": "Unauthorized", "code": 401 }
When successful, the response includes a task ID which can be used to check the status using GET /tasks/task_id
.
Model
{ // TypeScript, all fields are optional
task: {
id: number
userId: number
type: string
scene: string
status: number
status_name: 'submitted' | 'failed' | 'processing' | 'succeed'
status_final: boolean
taskInfo: {
type: string
inputs: Array<{
name: string
inputType: string
token: string | null
blobStorage: any | null
url: string
cover: string | null
fromWorkId: number | null
}>
arguments: Array<{
name: string
value: string
}>
extraArgs: Record<string, any>
callbackPayloads: any[]
scene: string
}
favored: boolean
deleted: boolean
viewed: boolean
createTime: number
updateTime: number
viewTime: number
}
works: Array<any>
status: number
status_name: 'submitted' | 'failed' | 'processing' | 'succeed'
status_final: boolean
message: string
limitation: {
type: string
remaining: number
limit: number
}
userPoints: {
points: Array<{
orderId: string
type: string
amount: number
balance: number
startTime: number
endTime: number
}>
total: number
}
userTickets: {
ticket: Array<{
orderId: string
type: string
packageType: string
amount: number
balance: number
startTime: number
endTime: number
}>
}
editProject: any | null
}
Examples
-
curl -X POST "https://api.useapi.net/v1/kling/videos/lipsync" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -d '{ "email": "[email protected]", "video": "https://example.com/video.mp4", "audio": "https://example.com/audio.mp3" }'
-
const token = "API token"; const email = "Previously configured account email"; const apiUrl = "https://api.useapi.net/v1/kling/videos/lipsync"; const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${token}`, }, body: JSON.stringify({ email: email, video: "https://example.com/video.mp4", audio: "https://example.com/audio.mp3" }) }); const result = await response.json(); console.log("response", {response, result});
-
import requests token = "API token" email = "Previously configured account email" apiUrl = "https://api.useapi.net/v1/kling/videos/lipsync" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } data = { "email": email, "video": "https://example.com/video.mp4", "audio": "https://example.com/audio.mp3" } response = requests.post(apiUrl, headers=headers, json=data) print(response, response.json())