Kling Lip Sync API

Make an existing Kling video (5 or 10 seconds) "speak" according to audio or text—that is, perform lip sync. Combined with /kling/videos image2video (bringing a photo to life), this creates a complete "talking photo / digital human presentation" workflow.

This endpoint is a single-step convenience wrapper provided by AceDataCloud for common audio/text-driven scenarios; it is not a field-by-field mirror of Kling's official "Face Recognition → Advanced Lip Sync" multi-step API. Please refer to the parameter table on this page.

  • Endpoint: POST https://api.acedata.cloud/kling/lip-sync
  • Request format: application/json
  • Response format: application/json
  • Billing: 2.45 Credits per successful call (fixed)

Request Headers

Log in to the application list, open the General Application, and click the copy button to the right of the API KEY field. Keep the key on the server for use as API_KEY in the request headers below.

Get an Ace Data Cloud API Key

Field Value Description
authorization Bearer ${API_KEY} Key for the General Application or an application authorized to use this endpoint
content-type application/json Request body format
accept application/json Response format

Request Body

Parameter Type Required Default Description
mode string Yes — Generation mode. Values: audio2video (audio-driven), text2video (text-driven)
video_id string One of two — ID of a video generated by Kling (such as the video_id returned by /kling/videos image2video). Only 5s/10s videos generated within the past 30 days are supported. Provide either video_id or video_url, not both
video_url string One of two — Publicly accessible video URL. Constraints: .mp4/.mov, ≤100MB, duration 2–10s, 720p/1080p only, side lengths 720–1920px. Provide either this or video_id
audio_url string Conditional — Download URL of the driving audio, required when audio2video + audio_type=url. Formats: .mp3/.wav/.m4a/.aac, ≤5MB
audio_type string No url Audio transfer method. Values: url, file (applies to audio2video)
audio_file string Conditional — Base64-encoded audio file, required when audio_type=file. Same formats as above, ≤5MB
text string Conditional — Text to be read aloud, required for text2video, up to 120 characters
voice_id string Conditional — Voice ID, required for text2video
voice_language string No zh Voice language. Values: zh, en (applies to text2video)
voice_speed float No 1.0 Speech speed, range 0.8–2.0, to one decimal place (applies to text2video)
callback_url string No — Callback URL. Providing this or async=true enables asynchronous mode: returns task_id immediately and sends a callback after the result is generated
async boolean No false Whether to run asynchronously. When true, returns task_id immediately, for use with /kling/tasks polling or a callback_url callback

Request Examples

1) Audio-driven (audio2video)

curl -X POST 'https://api.acedata.cloud/kling/lip-sync' \
  -H 'authorization: Bearer ${API_KEY}' \
  -H 'content-type: application/json' \
  -d '{
    "mode": "audio2video",
    "video_id": "895055164389466178",
    "audio_url": "https://cdn.acedata.cloud/6f7d62b18b.wav"
  }'

2) Text-driven (text2video)

curl -X POST 'https://api.acedata.cloud/kling/lip-sync' \
  -H 'authorization: Bearer ${API_KEY}' \
  -H 'content-type: application/json' \
  -d '{
    "mode": "text2video",
    "video_id": "895055164389466178",
    "text": "哥,好久不见,我一切都好,你要照顾好自己。",
    "voice_id": "genshin_vindi2",
    "voice_language": "zh",
    "voice_speed": 1.0
  }'

Response Example (Synchronous Success)

{
  "success": true,
  "task_id": "07a3ec65-9f7e-4a09-b7b7-282684082527",
  "video_id": "895055968777281546",
  "video_url": "https://cdn.acedata.cloud/assets/examples/kling/6c68c267-065b-4423-b66b-a0e4c59ee0d5-6a664a591a53.mp4",
  "duration": "4.966",
  "state": "succeed"
}
Field Type Description
success boolean Whether the task succeeded
task_id string ID of this task (can be used to query /kling/tasks)
video_id string Kling ID of the generated video (can be used as input for a subsequent extend/lip-sync)
video_url string URL of the generated talking video (stored on this platform's CDN and valid long-term)
duration string Video duration (seconds)
state string Task status: succeed / failed

Asynchronous Mode and Queries

When callback_url or async: true is provided, the endpoint immediately returns task_id; afterward, you can:

  • Poll: POST /kling/tasks, body { "action": "retrieve", "id": "<task_id>" } (free)
  • Callback: Once generation is complete, the result is POSTed to your callback_url

Complete Workflow: Talking Photo (image2video → lip-sync)

# 第 1 步:让照片动起来,拿到 video_id
curl -X POST 'https://api.acedata.cloud/kling/videos' \
  -H 'authorization: Bearer ${API_KEY}' -H 'content-type: application/json' \
  -d '{"model":"kling-v2-1-master","action":"image2video","start_image_url":"https://cdn.acedata.cloud/4hfydw.jpg","prompt":"look at camera, natural","duration":5,"mode":"pro"}'
# → { "video_id": "895055164389466178", ... }

# 第 2 步:用音频对口型
curl -X POST 'https://api.acedata.cloud/kling/lip-sync' \
  -H 'authorization: Bearer ${API_KEY}' -H 'content-type: application/json' \
  -d '{"mode":"audio2video","video_id":"895055164389466178","audio_url":"https://cdn.acedata.cloud/assets/examples/fish/5ade0339-5f11-487e-aacc-06a908271706-8e3fcb0e5547.mp3"}'
# → { "video_url": "https://cdn.acedata.cloud/assets/examples/kling/6c68c267-065b-4423-b66b-a0e4c59ee0d5-6a664a591a53.mp4", ... }

Error Response

{
  "success": false,
  "error": { "code": "bad_request", "message": "one of video_id or video_url is required" },
  "trace_id": "f07cab09-3c18-4d74-9030-64ee840d9f16",
  "task_id": "f490537f-2e5c-4739-8149-6252fba2091c"
}
HTTP code Meaning
400 bad_request Missing or invalid parameters (e.g., mode not provided, conflict between video and audio choices, text exceeds 120 characters)
401 authorization_missing Missing or invalid API key
403 forbidden Content blocked by risk controls
429 too_many_requests Request concurrency exceeds the limit; please try again later
500 api_error Service error

Notes

  • video_id must be a Kling video generated within 30 days and be 5s or 10s long; otherwise, use video_url to provide a video that meets the constraints.
  • For best lip-sync results, the input video should show one person facing the camera clearly.
  • The audio/text duration should match the video duration (audio must not exceed the video length).
  • Billing occurs on success (2.45 Credits per request); parameter validation failures (4xx) are not billed.