APIMODELSAPIMODELS
APIドキュメント

apimodels.app

Kling AI Lip Sync API reference

Kling AI Lip Sync puts new speech on an existing video: send a video with a person on screen and a new audio clip, and the same video comes back with the chosen face speaking the new audio. On APIMODELS it is one model id, kling-lip-sync, on the unified video endpoint, and it is one request: Kling's face detection runs inside it. The output keeps the input length; billing is $0.077 per started 5 seconds of the input video, with face detection included.

Still on the older two-step API (kling-identify-face + kling-lip-sync-video)? It keeps working; its reference is at the bottom of this page: Legacy two-step API.

Pricing

Input videoPrice
Per started 5 seconds$0.077
5 s video$0.077
6 s video (billed as 2 blocks)$0.154
10 s video$0.154
30 s video$0.462
60 s video (maximum)$0.924

Billing follows the input video, measured by us when the task is created; the audio length does not change the price and face detection is not billed separately. Videos or audio whose length cannot be read, or that fall outside 2-60 seconds, return a 400 before anything is charged; failed generations are not charged.

Authentication

All requests carry the API key in the header:

Authorization: Bearer YOUR_API_KEY

Create a task and poll it

POSThttps://api.apimodels.app/v1/video/generations·GET/v1/video/generations?task_id=
# Kling AI Lip Sync — an existing video + new audio -> the same video, lip-synced to the new audio.
# One request: face detection runs inside it. video_url and audio_url are required.
# Billed on the INPUT video: $0.077 per started 5 seconds (face detection included).
curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-lip-sync",
    "video_url": "https://example.com/interview.mp4",
    "audio_url": "https://example.com/new-line.mp3"
  }'

# Response (async — a task is created):
# { "code": 200, "msg": "success", "data": { "taskId": "clxxx", "state": "pending", "model": "kling-lip-sync" } }

# Poll every 10-15 s until completed (result files are kept 30 days)
curl "https://api.apimodels.app/v1/video/generations?task_id=TASK_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
# { "code": 200, "data": { "state": "completed",
#     "resultUrls": ["https://r2.apimodels.app/videos/clxxx.mp4"] } }

A task moves through pending → processing → completed or failed. On completed, data.resultUrls[0] is the MP4; on failed, the reason is in data.failMsg and the charge is returned. If no face is detected, or face_index is higher than the number of faces found, the task ends as failed and is not charged. In our test on 21 November 2026, a 6-second 720p video finished in 111 seconds; that is one measurement, not a promise.

Callback (callback_url)

To skip polling, pass callback_url in the create request. When the task reaches completed or failed we send an HTTP POST (JSON) to it. Failed deliveries are retried with backoff for up to 30 minutes, until your endpoint returns a 2xx. The URL must be publicly reachable; localhost and private addresses return a 400 at create time.

POST {your callback_url}
Content-Type: application/json

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "model": "kling-lip-sync",
    "state": "completed",                 // or "failed"
    "param": "<JSON string>",             // your request, JSON.parse once
    "resultJson": "<JSON string> | null", // {"resultUrls": ["https://...mp4"]}, JSON.parse once
    "failCode": null,
    "failMsg": null
  }
}

Parameters

FieldRequiredTypeDescription
modelYesstringkling-lip-sync (kling-lipsync and kling-advanced-lip-sync also work)
video_urlYesstringThe video to lip-sync, a public URL. MP4 or MOV, 2-60 seconds, 720p or 1080p, sides 512-2160 px, up to 100 MB. Its length sets the price.
audio_urlYesstringThe new speech, a public URL or base64 data URI. MP3, WAV, M4A or AAC, 2-60 seconds, up to 5 MB.
face_indexNointegerWhich detected face to use, from 0; default 0 (the first). One person per request.
audio_start_msNointegerWhere to start cutting the audio, in milliseconds; default 0.
audio_end_msNointegerWhere to stop cutting the audio, in milliseconds; default the end. The kept part must be at least 2 seconds.
insert_at_msNointegerWhere the audio starts in the video, in milliseconds; default when the chosen face first appears. The face must be on screen for at least 2 seconds while the audio plays.
audio_volumeNonumberVolume of the new speech, 0-2, default 1.
original_audio_volumeNonumberVolume of the video's own sound, 0-2, default 1; no effect on a silent video.
callback_urlNostringWe POST the result to this URL on completion; omit it and poll the GET endpoint instead.

Input limits

  • Video — MP4 or MOV; 2-60 seconds; 720p or 1080p with both sides between 512 and 2160 px; up to 100 MB.
  • Audio — MP3, WAV, M4A or AAC; 2-60 seconds; up to 5 MB. At least 2 seconds after trimming.
  • Face — One person per request; the chosen face must be on screen for at least 2 seconds while the audio plays.
  • Output — MP4, as long as the input video. One measured example: a 6.0-second 720p video + 3.5 s of speech → a 5.97-second video in 111 seconds.

Errors

Parameter problems come back synchronously as a 400 at creation ({"code": 400, "msg": "..."}): no task is created and nothing is charged. The msg strings below are the current wording (N is the actual number).

msgCause / fix
video_url is required: the video to lip-sync (mp4 / mov, 2–60 seconds, 720p or 1080p, up to 100 MB)No video was sent.
audio_url is required: the new speech (mp3 / wav / m4a / aac, 2–60 seconds, up to 5 MB)No audio was sent.
Unable to read the video duration — provide a publicly reachable mp4 or mov URLWe could not read the video length: the link needs a login, has expired, or is not a readable MP4 / MOV.
video is Ns — Kling Lip Sync accepts videos of 2–60 secondsThe video is outside 2-60 seconds.
Unable to read the audio duration — provide a publicly reachable mp3, wav, m4a or aac URLWe could not read the audio length. Use a link anyone can download directly.
audio is Ns — Kling Lip Sync accepts audio of 2–60 secondsThe audio is outside 2-60 seconds.
face_index must be a non-negative integer (milliseconds or index)face_index, audio_start_ms, audio_end_ms and insert_at_ms only take 0 or a positive whole number (the msg names the field).
audio_volume must be a number between 0 and 2audio_volume and original_audio_volume only take a number from 0 to 2.
audio_end_ms (N) is past the end of the audio (N ms)The trim end is past the end of the audio.
the audio segment (audio_end_ms − audio_start_ms) must be at least 2 secondsThe trimmed audio is shorter than 2 seconds.
insert_at_ms (N) is past the end of the video (N ms)The audio start time is past the end of the video.
  • 401: the API key is missing or invalid.
  • 402: the balance does not cover this video (5-second blocks × $0.077).
  • Failures during generation (no face detected, face_index out of range, content safety rejection, upstream error, timeout) end in state failed with the reason in data.failMsg, and the charge is returned automatically.

Notes

  • If you only have a photo and no video, use Kling AI Avatar (kling-avatar).
  • Result files are deleted after 30 days, so download or re-host them promptly.
  • Only upload faces, videos and voices you have the rights to use.

Try it in the Playground. Worked price examples are on the Kling AI Lip Sync model page.

Related

LS

Legacy two-step API (kling-identify-face + kling-lip-sync-video)

Kept for existing integrations: these model names keep working at the prices below. New integrations should use the one-call kling-lip-sync model above, which runs face detection inside the same request.

Advanced lip-sync for videos. Identify faces then sync them with custom audio tracks.

Quick Start

1
Get your API key from the Console
2
Call kling-identify-face to get sessionId and faceId
3
Call kling-lip-sync-video with sessionId, faceId and an audio track
4
Poll for the lip-synced video result

Authentication

Add Authorization header with Bearer token to all requests:

Authorization: Bearer YOUR_API_KEY

Available Models

ModelAPI NameFeaturesPrice (up to 60% off)
Face Recognitionkling-identify-faceDetect faces in video, returns sessionId + faceId$0.0100/call
Lip-Sync Videokling-lip-sync-videoLip-sync a video using sessionId + faceId + audio$0.0650/5s

Pricing (up to 60% off)

OperationPrice
Face Recognition (kling-identify-face)$0.0100/call
Lip-Sync Video (kling-lip-sync-video)$0.0650/5s

Endpoints

POST/api/v1/video/generations

Create a face recognition or lip sync task. Set model to "kling-identify-face" or "kling-lip-sync-video".

GET/api/v1/video/generations?task_id=xxx

Query task status and retrieve results

Two-Step Workflow

Lip sync requires two API calls. First, submit your video to "kling-identify-face" — this returns a session_id and a list of detected faces with their face_id values. Then, submit a second request to "kling-lip-sync-video" with the session_id, the face_id(s) you want to sync, and the corresponding audio source.

Request Parameters

Step 1 — Face Recognition (kling-identify-face)

Submit a video to identify faces. Returns a sessionId and faceId in resultJson, used by Step 2. $0.01 per call.

modelrequiredstring
"kling-identify-face"
videoUrlstring
Video URL (MP4/MOV, <=100MB, 2-60s, 720p/1080p, 512-2160px). A video narrower than 512 px or wider than 2160 px is rejected with 400 when the task is created, not charged. One of videoUrl/videoId required.
videoIdstring
Kling-generated video ID (within 30 days, <=60s). One of videoUrl/videoId required.
callback_urlstring
Webhook URL for completion notification

Step 2 — Lip-Sync Video (kling-lip-sync-video)

Use the sessionId and faceId from Step 1 to lip-sync the video with an audio track (audioId from kling-lip-sync-tts, or a direct audioUrl).

modelrequiredstring
"kling-lip-sync-video"
sessionIdrequiredstring
Session ID returned by kling-identify-face
faceIdrequiredstring
Face ID returned by kling-identify-face (e.g. "0")
audioIdstring
Audio ID from kling-lip-sync-tts (2-60s, within 30 days). One of audioId/audioUrl required.
audioUrlstring
Audio URL (.mp3/.wav/.m4a, <=5MB, 2-60s). One of audioId/audioUrl required.
soundStartTimerequiredint
Audio crop start (ms). Trimmed audio must be >=2s.
soundEndTimerequiredint
Audio crop end (ms). Trimmed audio must be >=2s.
soundInsertTimerequiredint
Insert time (ms). Must overlap the face lip-syncable window by >=2s and stay within the video bounds.
soundVolumefloat
Audio volume [0, 2]. Default 1.
originalAudioVolumefloat
Original video volume [0, 2]. Default 1 (no effect if the video is silent).
callback_urlstring
Webhook URL for completion notification

Text-to-Speech (kling-lip-sync-tts)

Synthesize speech from text with a preset voice — used to drive lip-sync. Returns an audio result.

modelrequiredstring
"kling-lip-sync-tts"
textrequiredstring
Text to synthesize. Max 1000 characters.
voiceIdrequiredstring
Voice ID — one of 45 presets. Enum: genshin_vindi2, zhinen_xuesheng, tiyuxi_xuedi, ai_shatang, genshin_klee2, genshin_kirara, ai_kaiya, tiexin_nanyou, ai_chenjiahao_712, girlfriend_1_speech02, chat1_female_new-3, girlfriend_2_speech02, cartoon-boy-07, cartoon-girl-01, ai_huangyaoshi_712, you_pingjing, ai_laoguowang_712, chengshu_jiejie, zhuxi_speech02, uk_oldman3, laopopo_speech02, heainainai_speech02, dongbeilaotie_speech02, chongqingxiaohuo_speech02, chuanmeizi_speech02, chaoshandashu_speech02, ai_taiwan_man2_speech02, xianzhanggui_speech02, tianjinjiejie_speech02, diyinnansang_DB_CN_M_04-v2, yizhipiannan-v1, guanxiaofang-v2, tianmeixuemei-v1, daopianyansang-v1, mengwa-v1, AOT, oversea_male1, girlfriend_4_speech02, chat_0407_5-1, uk_boy1, PeppaPig_platform, ai_huangzhong_712, calm_story1, uk_man2, reader_en_m-v1, commercial_lady_en_f-v1
voiceLanguagerequiredstring
Voice language, must match the chosen voice. Enum: zh / en. Default: zh.
voiceSpeedfloat
Playback speed, 0.8–2.0 (1 decimal). Default: 1.0.

Code Examples

# Step 1: Identify faces in the video
curl -X POST https://api.apimodels.app/v1/video/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling-identify-face",
    "video_url": "https://example.com/video.mp4"
  }'

Response Format

Create Task Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "pending",
    "model": "kling-identify-face"
  }
}

Face Recognition — Success

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "completed",
    "model": "kling-identify-face",
    "resultUrls": [],
    "resultJson": "{ \"resultUrls\": [], \"sessionId\": \"891032747618619461\", \"faceId\": \"0\", \"faces\": [{ \"face_id\": \"0\", \"start_time\": 0, \"end_time\": 13500 }] }"
  }
}

JSON.parse(data.resultJson) → use sessionId and faceId for kling-lip-sync-video. faces[] also carries the start_time / end_time window per face.

Lip Sync — Success

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "completed",
    "model": "kling-lip-sync-video",
    "resultUrls": ["https://...lip_synced_video.mp4"]
  }
}

Failed Response

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "state": "failed",
    "failMsg": "Face detection failed: no faces found"
  }
}

Webhook Callback (callback_url)

Pass callback_url in the create request. When the task reaches the completed or failed terminal state, our server sends a single HTTP POST to that URL with Content-Type: application/json (no signing header). Delivery is retried up to 3 times (exponential backoff 1s/2s/4s, 10s per attempt); if still unsuccessful, a background job keeps retrying for up to 30 minutes until your endpoint returns 2xx.

Payload Structure

POST {your callback_url}
Content-Type: application/json

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "clxxx...",
    "model": "kling-lip-sync-video",
    "state": "completed" | "failed",
    "param": "<JSON string>",            // request params, JSON.parse once
    "resultJson": "<JSON string> | null", // result object, JSON.parse once
    "failCode": null | "CONTENT_MODERATION | INVALID_INPUT | INSUFFICIENT_BALANCE | UPSTREAM_BUSY | UPSTREAM_FAILED | TIMEOUT | INTERNAL_ERROR | OTHER",
    "failMsg": null | "string",
    "retryable": true | false,           // present when state=failed: safe to retry/fallback
    "costTime": 12345,                    // duration in ms
    "completeTime": 1705123500000,        // ms epoch
    "createTime": 1705123450000           // ms epoch
  }
}

Note: data.param and data.resultJson are both JSON strings — call JSON.parse once on each.

Lip-sync (video) task: shape after JSON.parse(data.resultJson)

{
  "resultUrls":    ["https://r2.apimodels.app/videos/lip_synced.mp4"],
  "videoDuration": 8                   // optional, seconds
}

Lip-sync produces a video file. resultUrls is always present (length 1 in success, [] on failure). videoDuration may be present on some upstream branches. When state=failed, resultJson is typically null or {"resultUrls":[]}.

Node.js receiver example

app.post('/webhook/kling-lip-sync', express.json(), (req, res) => {
  const { taskId, state, resultJson, failMsg } = req.body.data
  if (state === 'completed') {
    const r = JSON.parse(resultJson)
    console.log('lip-sync ready', taskId, r.resultUrls[0])
  } else {
    console.warn('lip-sync failed', taskId, failMsg)
  }
  res.status(200).end()                 // must be 2xx, otherwise we retry
})

Notes

  • -A task stops retrying only after a 2xx response — once delivered it is never pushed again.
  • -Callbacks are not signed today. Embed a random token in your callback_url path and verify it on receipt.
  • -For the kling-identify-face step the callback fires once face_list is ready — read it from JSON.parse(param) or from the GET poll response, not from resultJson.
  • -Use a public HTTPS endpoint that responds within 10 seconds (per-attempt timeout).

Task States

pendingTask queued, waiting to process
processingTask is being executed
completedTask completed successfully
failedTask failed

Error Codes

400Bad Request - Missing or invalid parameters
401Unauthorized - Invalid API key
402Payment Required - Insufficient credits
404Not Found - Task ID not found
500Internal Server Error

Important Notes

  • *Two-step process: always run kling-identify-face first to get sessionId
  • *sessionId and faceId from step 1 are required for step 2
  • *Provide the audio as audioId (from kling-lip-sync-tts) or a direct audioUrl, plus soundStartTime/soundEndTime/soundInsertTime (ms)
  • *Results are stored for 30 days, download the video promptly
  • *Lip sync pricing is $0.0650 per 5s segment of the output video
  • *Poll every 5-10 seconds to check task status

FAQ

How much does the Kling AI Lip Sync API cost?

$0.077 per started 5 seconds of the input video, measured when the task is created; the audio length does not change the price and face detection is included. Failed generations are not charged.

Do I need to call face detection first?

No. Send video_url and audio_url in one request; we run face detection inside it. Use face_index to pick a face other than the first one.

What happens if no face is found?

The task ends as failed with the reason in data.failMsg, and it is not charged. The same applies when face_index is higher than the number of faces detected.

Does the old two-step API (kling-identify-face + kling-lip-sync-video) still work?

Yes. It is kept for existing integrations at $0.065 per 5 seconds of output video, and its reference is at the bottom of this page. New integrations should use the one-call kling-lip-sync model.