Kling Video API

Create videos from text or reference images, and choose a model to suit your project.

Text-to-video

Choose an available model and describe the scene, action, and camera shots.

Images and multiple shots

Prepare reference materials and corresponding parameters for your chosen model.

Asynchronous results

Save the task_id after submission and retrieve the video file when complete.

Start with your first request

Get a Key, copy the request, and view the corresponding JSON response below.

Request
export ACEDATACLOUD_API_KEY="YOUR_API_KEY"
curl --request POST "https://api.acedata.cloud/kling/videos" \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "action": "text2video",
  "model": "kling-v3",
  "mode": "std",
  "duration": 5,
  "prompt": "A small sailboat crossing a calm lake at sunrise.",
  "async": true
}'
Submission response JSON

Below is an excerpt of key fields from the current API response. The task ID, usage, and generated content depend on the values returned by your request.

{
  "task_id": "20068983-0cc9-4c6a-aeb6-9c6a3c668be0"
}

Query the original task and retrieve results

Use the task ID returned upon submission to check progress and retrieve the final result.

Request
curl --request POST "https://api.acedata.cloud/kling/tasks" \
  --header "Authorization: Bearer $ACEDATACLOUD_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"action": "retrieve", "id": "20068983-0cc9-4c6a-aeb6-9c6a3c668be0"}'
In-progress response JSON

The following illustrates the fields for a task in progress. Continue querying the same ID until completion.

{
  "id": "20068983-0cc9-4c6a-aeb6-9c6a3c668be0",
  "type": "videos",
  "finished_at": null
}
Completed response JSON

The following is an excerpt of key fields from the existing API response. Refer to the values returned by your request for the task ID, usage, and generated content.

{
  "id": "20068983-0cc9-4c6a-aeb6-9c6a3c668be0",
  "type": "videos",
  "started_at": 1740969535.393,
  "finished_at": 1740969852.463,
  "elapsed": 317.07,
  "response": {
    "success": true,
    "task_id": "20068983-0cc9-4c6a-aeb6-9c6a3c668be0",
    "video_url": "https://cdn.acedata.cloud/assets/examples/gemini/04a043bd-6b23-4b4e-945c-ce48158c3eee-3a89912507c7.mp4",
    "state": "succeed"
  }
}

Support for image input, sound, and multiple shots depends on the selected model. Prepare your assets according to the relevant parameter descriptions.

Read the video or audio track URL returned in response. If the task fails, read the error message and end the query process.

API calls and costs

Refer to the current API and pricing page for request parameters, available models, and costs. If you encounter authentication, balance, or quota errors, check the Key's associated application, validity period, and usage restrictions. Retain the trace_id when troubleshooting requests.

View parameters, response fields, and error handling

Integrate the Kling Video API into your application

Continue to the complete guide for parameters, result fields, and error handling.