Kwaivgi Kling Elements API Documentation

Kwaivgi Kling Elements API Documentation

Playground

Try it on WaveSpeedAI!

Kling Elements creates custom AI elements from reference images for video generation. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.

Features

Kling Elements creates custom AI elements from reference images for video generation. Define reusable visual elements — characters, clothing, objects, or styles — that can be consistently applied across multiple Kling video generations.


Why Choose This?

  • Reusable AI elements Create custom elements once, use them across multiple video generations for consistent results.

  • Multi-reference support Upload multiple reference images to better capture the element’s visual characteristics.

  • Character consistency Maintain the same character appearance, clothing, or style across different videos.

  • Simple workflow Define elements with a name, description, and reference images — ready to use in video generation.

  • Affordable pricing Just $0.01 per element creation.


Parameters

ParameterRequiredDescription
nameYesName for the element (e.g., “Work Suit”, “Main Character”)
descriptionYesDescription of the element’s visual characteristics
imageYesPrimary reference image (URL or upload)
element_refer_listYesAdditional reference images (click ”+ Add Item” to add)
tag_listNoTags for organizing and categorizing elements

How to Use

  1. Enter element name — give your element a clear, descriptive name.
  2. Write description — describe the element’s visual characteristics in detail.
  3. Upload primary image — provide the main reference image.
  4. Add reference images — upload additional images showing the element from different angles or contexts.
  5. Add tags (optional) — categorize your element for easier management.
  6. Run — submit to create your custom AI element.
  7. Save the element_id — use this ID in Kling video generation to apply the element.

Pricing

OutputCost
Per element$0.01

Best Use Cases

  • Character Consistency — Create character elements for consistent appearance across video series.
  • Wardrobe Management — Define clothing elements for virtual try-on or fashion videos.
  • Brand Assets — Create reusable brand elements (logos, mascots, products) for marketing videos.
  • Style Templates — Define visual styles that can be applied consistently.
  • Product Visualization — Create product elements for e-commerce video content.

Pro Tips

  • Use multiple reference images showing the element from different angles for better recognition.
  • Write detailed descriptions including colors, textures, and distinctive features.
  • Keep element names clear and descriptive for easy identification later.
  • Use tags to organize elements by project, category, or use case.
  • Save the returned element_id — you’ll need it to use the element in video generation.

Notes

  • All required fields (name, description, image, element_refer_list) must be provided.
  • The output includes an element_id that can be used in Kling video models.
  • Ensure uploaded image URLs are publicly accessible.
  • Multiple reference images improve element consistency.

Authentication

For authentication details, please refer to the Authentication Guide.

API Endpoints

Submit Task & Query Result

set -euo pipefail

export WAVESPEED_API_KEY="your-api-key"

REQUEST_BODY=$(cat <<'JSON'
{
  "name": "Example",
  "description": "A clear example input",
  "image": "https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg",
  "element_refer_list": [
    "https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg"
  ]
}
JSON
)

# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
  -X POST "https://api.wavespeed.ai/api/v3/kwaivgi/kling-elements" \
  -H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}")

TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
  printf 'Submission response did not contain a prediction id
' >&2
  exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"

# 2. Poll until the prediction finishes.
while true; do
  RESPONSE=$(curl --silent --show-error --fail-with-body \
    "${RESULT_URL}" \
    -H "Authorization: Bearer ${WAVESPEED_API_KEY}")
  RESULT=$(printf '%s' "${RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
  STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')

  case "${STATUS}" in
    completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
    failed|cancelled|timeout|deleted) printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
    *) sleep 2 ;;
  esac
done

Parameters

Task Submission Parameters

Request Parameters

ParameterTypeRequiredDefaultRangeDescription
namestringYes--Element name, It cannot exceed 20 characters.
descriptionstringYes--Element description, It cannot exceed 100 characters.
imagestringYes-Front reference image, The size of the image file should not exceed 10MB, and the width and height dimensions of the image should be no less than 300px.
element_refer_listarray<string>Yes-0 ~ 3 itemsOther reference list of the element.
voice_idstringNo--The voice ID of element can be bound to existing tone colors in the tone library.

Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
data.idstringUnique identifier for the prediction, Task Id
data.modelstringModel ID used for the prediction
data.outputsarrayOutput values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed)
data.urlsobjectObject containing related API endpoints
data.statusstringTask status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses.
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds

Result Request Parameters

ParameterTypeRequiredDefaultDescription
idstringYes-Task ID

Result Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
dataobjectThe prediction data object containing all details
data.idstringUnique identifier for the prediction
data.modelstringModel ID used for the prediction
data.outputsarray<string | object>Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model.
data.urlsobjectObject containing related API endpoints
data.statusstringStatus: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses
data.created_atstringISO timestamp of when the request was created
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds
© 2026 WaveSpeedAI. All rights reserved.