MaasUnionMaasUnion
API Reference
AI Model APIVideoKling Video

Kling Lip Sync (Two-Step)

Channel type: Kling Extended (66) Gateway path: Identify face POST https://maasunion.com/kling/v1/extended/videos/identify-face (sync) Lip sync synthesis POST/GET https://maasunion.com/kling/v1/extended/videos/advanced-lip-sync Official upstream: https://api-beijing.klingai.com (/v1/videos/identify-face, /v1/videos/advanced-lip-sync)


Overview

Advanced lip sync is a two-step process:

  1. Identify face (sync): upload a video; synchronously return the faces detected in the video and a session_id
  2. Lip sync synthesis (async): based on the session_id and the selected face/audio, generate a lip-synced video

Authentication

HeaderRequiredDescription
AuthorizationYesBearer {your_api_token}
Content-TypeRequired for POSTapplication/json

Step 1: Identify Face (Sync)

POST https://maasunion.com/kling/v1/extended/videos/identify-face

Request Parameters

ParameterTypeRequiredDescription
video_urlstringYesVideo URL
video_idstringNoVideo ID (can be left empty)

Request Example

curl --request POST \
  --url "https://maasunion.com/kling/v1/extended/videos/identify-face" \
  --header "Authorization: Bearer {your_api_token}" \
  --header "Content-Type: application/json" \
  --data '{
    "video_url": "https://example.com/video.mp4",
    "video_id": ""
  }'

Sync Response

{
  "code": 0,
  "message": "string",
  "request_id": "string",
  "data": {
    "session_id": "id",
    "final_unit_deduction": "string",
    "face_data": [
      {
        "face_id": "string",
        "face_image": "url",
        "start_time": 0,
        "end_time": 5200
      }
    ]
  }
}
FieldDescription
data.session_idSession ID, used for step 2
data.face_data[].face_idFace ID
data.face_data[].face_imageFace screenshot URL
data.face_data[].start_time / end_timeTime range during which the face appears (milliseconds)

Step 2: Lip Sync Synthesis (Async)

POST https://maasunion.com/kling/v1/extended/videos/advanced-lip-sync

Request Parameters

ParameterTypeRequiredDescription
session_idstringYesThe session_id returned in step 1
face_choosearrayYesSelected face and audio configuration, see the table below
external_task_idstringNoCustom task ID

face_choose[]

ParameterTypeDescription
face_idstringThe face ID returned in step 1
sound_filestringAudio file URL
sound_insert_timenumberAudio insertion time (milliseconds)
sound_start_timenumberAudio start time (milliseconds)
sound_end_timenumberAudio end time (milliseconds)
sound_volumenumberAudio volume
original_audio_volumenumberOriginal audio volume

Request Example

curl --request POST \
  --url "https://maasunion.com/kling/v1/extended/videos/advanced-lip-sync" \
  --header "Authorization: Bearer {your_api_token}" \
  --header "Content-Type: application/json" \
  --data '{
    "session_id": "第1步返回的session_id",
    "face_choose": [
      {
        "face_id": "0",
        "sound_file": "https://example.com/voice.mp3",
        "sound_insert_time": 1000,
        "sound_start_time": 0,
        "sound_end_time": 3000,
        "sound_volume": 2,
        "original_audio_volume": 2
      }
    ]
  }'

Create Response

{
  "code": 0,
  "message": "string",
  "request_id": "string",
  "data": {
    "task_id": "gateway_public_task_id",
    "task_status": "submitted",
    "created_at": 1722769557708,
    "updated_at": 1722769557708
  }
}

Query Task

GET https://maasunion.com/kling/v1/extended/videos/advanced-lip-sync/{task_id}

curl --request GET \
  --url "https://maasunion.com/kling/v1/extended/videos/advanced-lip-sync/{task_id}" \
  --header "Authorization: Bearer {your_api_token}"

The query response returns the synthesized video in task_result.videos, with the same structure as the standard video.


Task Status

task_statusMeaning
submittedSubmitted
processingProcessing
succeedSucceeded
failedFailed

Identify face is a synchronous endpoint that returns results directly; no polling required.

For more general information, see Kling Gateway Overview.

How is this guide?