Skip to main content
AI

Digital Human Video

This document explains how to use Kling Avatar v2 async digital human video generationEndpoint.

Supported models:

Model nameTypeSuitable scenariosBilling mode
kling-avatar-v2-standarddigital human videostandard narration, customer-service explanation, course introduction, marketing short videobilled by output video duration
kling-avatar-v2-prodigital human videohigher-quality digital-human narration, formal promotional video, brand video, important course contentbilled by output video duration

Endpoint async task mode:

OperationMethodPath
submitdigital human videotaskPOST/v1/video/generations
querydigital human videotaskGET/v1/video/generations/{task_id}

1. Authentication

Endpoint requires request headers API Key:

Authorization: Bearer sk-xxxxxxxxxxxxxxxx
Content-Type: application/json

Example:

https://api.xxx.xx

2. Model overview

Kling Avatar v2 imageandaudio generationdigital human video. userrequiresprovidesone imageandaaudio, Model generation and action video.

supports:

ModelNote
kling-avatar-v2-standardstandard, standard narrationand generation
kling-avatar-v2-proPro, stable

3. submitdigital human videotask

POST https://api.xxx.xx/v1/video/generations

3.1 Request Parameters

ParametersTypeRequiredNote
modelstringYeskling-avatar-v2-standard or kling-avatar-v2-pro
image_urlstringYesimage URL
audio_urlstringYesaudio URL,
audio_duration_secondsnumberYesaudioduration, submit billing
promptstringNostyle, scenario, Status, camera

Note:

  • audio_duration_seconds pass.
  • Field submit, billing.
  • pass inaudio duration, cost and task.

3.2 submitResponse Examples

{
"id": "task_xxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxx",
"object": "video.generation.job",
"status": "queued"
}

Field Reference:

FieldNote
id/task_idasync task ID, query result
statustask status, value queued, processing, completed, failed

4. querydigital human videotask

GET https://api.xxx.xx/v1/video/generations/{task_id}

queryExample:

curl -X GET "https://api.xxx.xx/v1/video/generations/task_xxxxxxxxxxxxx" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx"

Completed Response Example:

{
"id": "task_xxxxxxxxxxxxx",
"task_id": "task_xxxxxxxxxxxxx",
"object": "video.generation.job",
"status": "completed",
"video_url": "https://api.xxx.xx/media/xxxxx.mp4",
"result": {
"outputs": [
"https://api.xxx.xx/media/xxxxx.mp4"
]
}
}

5. Request Examples

5.1 Standard generationcustomer-service explanationvideo

curl -X POST "https://api.xxx.xx/v1/video/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "kling-avatar-v2-standard",
"image_url": "https://cdn.example.com/avatar/customer-service.png",
"audio_url": "https://cdn.example.com/audio/customer-intro.mp3",
"audio_duration_seconds": 12,
"prompt": "friendly customer service presenter, natural expression, clean studio lighting"}'

5.2 Standard generationcourse introduction

curl -X POST "https://api.xxx.xx/v1/video/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "kling-avatar-v2-standard",
"image_url": "https://cdn.example.com/avatar/teacher.png",
"audio_url": "https://cdn.example.com/audio/course-opening.mp3",
"audio_duration_seconds": 18.5,
"prompt": "professional teacher, warm smile, stable camera, natural lip sync"}'

5.3 Pro generation video

curl -X POST "https://api.xxx.xx/v1/video/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "kling-avatar-v2-pro",
"image_url": "https://cdn.example.com/avatar/brand-host.png",
"audio_url": "https://cdn.example.com/audio/brand-message.mp3",
"audio_duration_seconds": 24,
"prompt": "premium corporate spokesperson video, clean studio background, confident expression"}'

5.4 Pro generationnews broadcast

curl -X POST "https://api.xxx.xx/v1/video/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "kling-avatar-v2-pro",
"image_url": "https://cdn.example.com/avatar/news-anchor.png",
"audio_url": "https://cdn.example.com/audio/news-briefing.mp3",
"audio_duration_seconds": 32.7,
"prompt": "news anchor style, formal tone, stable frontal shot, neutral expression"}'

6. Common Errors

6.1 image_url

digital human video provides image:

{
"image_url": "https://cdn.example.com/avatar.png"
}

6.2 audio_url

digital human video provides audio:

{
"audio_url": "https://cdn.example.com/voice.mp3"
}

6.3 audio_duration_seconds

Error:

{
"model": "kling-avatar-v2-standard",
"image_url": "https://cdn.example.com/avatar.png",
"audio_url": "https://cdn.example.com/voice.mp3"
}

audioduration:

{
"audio_duration_seconds": 12.5
}

  1. image.
  2. use TTS or generate aaudio.
  3. audio duration.
  4. submit /v1/video/generations, pass in image_url, audio_url, audio_duration_seconds.
  5. poll /v1/video/generations/{task_id}.
  6. task completed read video_url.

8. Minimum Valid Request

8.1 Avatar Standard

curl -X POST "https://api.xxx.xx/v1/video/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "kling-avatar-v2-standard",
"image_url": "https://cdn.example.com/avatar.png",
"audio_url": "https://cdn.example.com/voice.mp3",
"audio_duration_seconds": 10}'

8.2 Avatar Pro

curl -X POST "https://api.xxx.xx/v1/video/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"model": "kling-avatar-v2-pro",
"image_url": "https://cdn.example.com/avatar.png",
"audio_url": "https://cdn.example.com/voice.mp3",
"audio_duration_seconds": 10}'