Kling AI Lip-Sync API
Drive lip movement on a generated or uploaded video from supplied text (text-to-speech voice) or an audio file, syncing a subject's mouth to speech. Async create-then-query task pattern.
Drive lip movement on a generated or uploaded video from supplied text (text-to-speech voice) or an audio file, syncing a subject's mouth to speech. Async create-then-query task pattern.
openapi: 3.0.3
info:
title: Kling AI Open Platform API
description: >-
The Kling AI Open Platform is the developer API for Kuaishou's Kling
generative video and image models. Every capability follows the same
asynchronous pattern: submit a task with POST (receiving a task_id), then
poll the matching GET endpoint by task_id until status is succeed and the
generated video or image URLs are returned. Generated asset URLs are
short-lived and should be downloaded promptly. Authentication uses a JWT
(HS256) signed from an Access Key / Secret Key pair, passed as a Bearer
token; tokens are short-lived (about 30 minutes).
endpointsModeled: The overall path structure, async task model, JWT auth,
and model catalog are grounded in Kling's official Open Platform
documentation and cross-referenced against multiple Kling API wrappers.
Kling's official reference pages block automated fetching (HTTP 446), so
exact request/response field-level schemas here are honestly modeled on the
documented behavior rather than copied verbatim, and should be reconciled
against the live reference before code generation.
version: '1.0'
contact:
name: Kling AI Open Platform
url: https://app.klingai.com/global/dev
servers:
- url: https://api.klingai.com
description: Kling AI Open Platform (global)
security:
- bearerAuth: []
tags:
- name: Text-to-Video
description: Generate video from a text prompt.
- name: Image-to-Video
description: Animate images into video.
- name: Video Extension
description: Extend an existing generated video.
- name: Lip-Sync
description: Sync a subject's lips to speech or audio.
- name: Video Effects
description: Apply preset creative effects to images.
- name: Image Generation
description: Generate still images with the Kolors models.
- name: Virtual Try-On
description: Composite a garment onto a person image.
- name: Account
description: Resource-pack balance and consumption.
paths:
/v1/videos/text2video:
post:
operationId: createTextToVideoTask
tags:
- Text-to-Video
summary: Create a text-to-video task
description: Submit a text prompt to generate a video. Returns a task_id to poll.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TextToVideoRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
/v1/videos/text2video/{task_id}:
get:
operationId: getTextToVideoTask
tags:
- Text-to-Video
summary: Query a text-to-video task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the generated video URL.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoTaskResponse'
'401':
$ref: '#/components/responses/Unauthorized'
/v1/videos/image2video:
post:
operationId: createImageToVideoTask
tags:
- Image-to-Video
summary: Create an image-to-video task
description: Animate a start image (and optional end image) with a motion prompt.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ImageToVideoRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
/v1/videos/image2video/{task_id}:
get:
operationId: getImageToVideoTask
tags:
- Image-to-Video
summary: Query an image-to-video task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the generated video URL.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoTaskResponse'
/v1/videos/multi-image2video:
post:
operationId: createMultiImageToVideoTask
tags:
- Image-to-Video
summary: Create a multi-image-to-video task
description: Compose a video from multiple reference images plus a prompt.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MultiImageToVideoRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
/v1/videos/multi-image2video/{task_id}:
get:
operationId: getMultiImageToVideoTask
tags:
- Image-to-Video
summary: Query a multi-image-to-video task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the generated video URL.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoTaskResponse'
/v1/videos/video-extend:
post:
operationId: createVideoExtendTask
tags:
- Video Extension
summary: Create a video-extension task
description: Extend an existing generated video by its origin task id.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VideoExtendRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
/v1/videos/video-extend/{task_id}:
get:
operationId: getVideoExtendTask
tags:
- Video Extension
summary: Query a video-extension task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the extended video URL.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoTaskResponse'
/v1/videos/lip-sync:
post:
operationId: createLipSyncTask
tags:
- Lip-Sync
summary: Create a lip-sync task
description: Sync a video subject's lips to supplied text (TTS) or an audio file.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LipSyncRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
/v1/videos/lip-sync/{task_id}:
get:
operationId: getLipSyncTask
tags:
- Lip-Sync
summary: Query a lip-sync task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the lip-synced video URL.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoTaskResponse'
/v1/videos/effects:
post:
operationId: createVideoEffectsTask
tags:
- Video Effects
summary: Create a video-effects task
description: Apply a preset creative effect to one or more input images.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VideoEffectsRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
/v1/videos/effects/{task_id}:
get:
operationId: getVideoEffectsTask
tags:
- Video Effects
summary: Query a video-effects task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the effect video URL.
content:
application/json:
schema:
$ref: '#/components/schemas/VideoTaskResponse'
/v1/images/generations:
post:
operationId: createImageGenerationTask
tags:
- Image Generation
summary: Create an image-generation task
description: Generate still images from a text prompt with the Kolors models.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ImageGenerationRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
/v1/images/generations/{task_id}:
get:
operationId: getImageGenerationTask
tags:
- Image Generation
summary: Query an image-generation task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the generated image URLs.
content:
application/json:
schema:
$ref: '#/components/schemas/ImageTaskResponse'
/v1/images/kolors-virtual-try-on:
post:
operationId: createVirtualTryOnTask
tags:
- Virtual Try-On
summary: Create a virtual try-on task
description: Composite a garment image onto a person/model image.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VirtualTryOnRequest'
responses:
'200':
description: Task accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/TaskCreatedResponse'
/v1/images/kolors-virtual-try-on/{task_id}:
get:
operationId: getVirtualTryOnTask
tags:
- Virtual Try-On
summary: Query a virtual try-on task
parameters:
- $ref: '#/components/parameters/TaskId'
responses:
'200':
description: Task status and, when complete, the try-on image URLs.
content:
application/json:
schema:
$ref: '#/components/schemas/ImageTaskResponse'
/account/costs:
get:
operationId: getAccountResourcePacks
tags:
- Account
summary: Query resource-pack balances
description: Return remaining prepaid resource-pack balances and consumption.
parameters:
- name: start_time
in: query
required: false
schema:
type: integer
description: Start of the query window as a Unix millisecond timestamp.
- name: end_time
in: query
required: false
schema:
type: integer
description: End of the query window as a Unix millisecond timestamp.
responses:
'200':
description: Resource-pack balance and consumption detail.
content:
application/json:
schema:
$ref: '#/components/schemas/AccountCostsResponse'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: >-
A JWT signed with HS256 from your Access Key (as the iss claim) and
Secret Key, passed as Authorization: Bearer <token>. Tokens are
short-lived (about 30 minutes; nbf is typically set 5 seconds in the
past).
parameters:
TaskId:
name: task_id
in: path
required: true
schema:
type: string
description: The task identifier returned by the create-task call.
responses:
Unauthorized:
description: Missing, invalid, or expired JWT.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
RateLimited:
description: Too many requests or concurrency limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
TextToVideoRequest:
type: object
required:
- prompt
properties:
model_name:
type: string
description: Video model, e.g. kling-v1, kling-v1-6, kling-v2-master, kling-v2-1, kling-v2-5-turbo, kling-v2-6.
example: kling-v2-6
prompt:
type: string
description: Text description of the video to generate.
negative_prompt:
type: string
description: Content to avoid.
cfg_scale:
type: number
description: Prompt adherence strength, 0 to 1.
mode:
type: string
enum:
- std
- pro
description: Standard or professional generation mode.
aspect_ratio:
type: string
enum:
- '16:9'
- '9:16'
- '1:1'
description: Output aspect ratio.
duration:
type: string
enum:
- '5'
- '10'
description: Video length in seconds.
callback_url:
type: string
description: Optional URL notified when the task completes.
ImageToVideoRequest:
type: object
required:
- image
properties:
model_name:
type: string
example: kling-v2-6
image:
type: string
description: Start-frame image as a URL or base64 string.
image_tail:
type: string
description: Optional end-frame image as a URL or base64 string.
prompt:
type: string
negative_prompt:
type: string
cfg_scale:
type: number
mode:
type: string
enum:
- std
- pro
duration:
type: string
enum:
- '5'
- '10'
callback_url:
type: string
MultiImageToVideoRequest:
type: object
required:
- image_list
- prompt
properties:
model_name:
type: string
example: kling-v1-6
image_list:
type: array
items:
type: string
description: List of reference image URLs or base64 strings.
prompt:
type: string
mode:
type: string
enum:
- std
- pro
duration:
type: string
enum:
- '5'
- '10'
callback_url:
type: string
VideoExtendRequest:
type: object
required:
- video_id
properties:
video_id:
type: string
description: The origin task/video id of a previously generated video to extend.
prompt:
type: string
description: Optional continuation prompt.
callback_url:
type: string
LipSyncRequest:
type: object
properties:
video_id:
type: string
description: Origin task/video id of the video to lip-sync.
video_url:
type: string
description: Alternatively, a URL to the source video.
mode:
type: string
enum:
- text2video
- audio2video
description: Drive lips from generated speech (text) or from an audio file.
text:
type: string
description: Text to synthesize into speech when mode is text2video.
voice_id:
type: string
description: Voice identifier for text-to-speech.
audio_url:
type: string
description: Audio file URL when mode is audio2video.
callback_url:
type: string
VideoEffectsRequest:
type: object
required:
- effect_scene
properties:
effect_scene:
type: string
description: Preset effect name, e.g. hug, kiss, squish, expansion.
model_name:
type: string
example: kling-v1-6
image:
type: string
description: Input image URL or base64 string.
images:
type: array
items:
type: string
description: Multiple input images for effects that require them.
duration:
type: string
enum:
- '5'
callback_url:
type: string
ImageGenerationRequest:
type: object
required:
- prompt
properties:
model_name:
type: string
description: Image model, e.g. kling-v1, kling-v1-5, kling-v2, kling-v2-1.
example: kling-v2-1
prompt:
type: string
negative_prompt:
type: string
image:
type: string
description: Optional reference image URL or base64 string.
image_reference:
type: string
enum:
- subject
- face
description: How the reference image is used.
n:
type: integer
description: Number of images to generate.
aspect_ratio:
type: string
enum:
- '16:9'
- '9:16'
- '1:1'
- '4:3'
- '3:4'
callback_url:
type: string
VirtualTryOnRequest:
type: object
required:
- human_image
- cloth_image
properties:
model_name:
type: string
example: kolors-virtual-try-on-v1-5
human_image:
type: string
description: Person/model image URL or base64 string.
cloth_image:
type: string
description: Garment image URL or base64 string.
callback_url:
type: string
TaskCreatedResponse:
type: object
properties:
code:
type: integer
description: Business status code (0 indicates success).
message:
type: string
request_id:
type: string
data:
type: object
properties:
task_id:
type: string
task_status:
type: string
enum:
- submitted
- processing
- succeed
- failed
created_at:
type: integer
updated_at:
type: integer
VideoTaskResponse:
type: object
properties:
code:
type: integer
message:
type: string
request_id:
type: string
data:
type: object
properties:
task_id:
type: string
task_status:
type: string
enum:
- submitted
- processing
- succeed
- failed
task_result:
type: object
properties:
videos:
type: array
items:
type: object
properties:
id:
type: string
url:
type: string
duration:
type: string
ImageTaskResponse:
type: object
properties:
code:
type: integer
message:
type: string
request_id:
type: string
data:
type: object
properties:
task_id:
type: string
task_status:
type: string
enum:
- submitted
- processing
- succeed
- failed
task_result:
type: object
properties:
images:
type: array
items:
type: object
properties:
index:
type: integer
url:
type: string
AccountCostsResponse:
type: object
properties:
code:
type: integer
message:
type: string
data:
type: object
properties:
resource_pack_subscribe_infos:
type: array
items:
type: object
properties:
resource_pack_name:
type: string
resource_pack_type:
type: string
total_quantity:
type: number
remaining_quantity:
type: number
status:
type: string
Error:
type: object
properties:
code:
type: integer
message:
type: string
request_id:
type: string