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
| Parameter | Required | Description |
|---|---|---|
| name | Yes | Name for the element (e.g., “Work Suit”, “Main Character”) |
| description | Yes | Description of the element’s visual characteristics |
| image | Yes | Primary reference image (URL or upload) |
| element_refer_list | Yes | Additional reference images (click ”+ Add Item” to add) |
| tag_list | No | Tags for organizing and categorizing elements |
How to Use
- Enter element name — give your element a clear, descriptive name.
- Write description — describe the element’s visual characteristics in detail.
- Upload primary image — provide the main reference image.
- Add reference images — upload additional images showing the element from different angles or contexts.
- Add tags (optional) — categorize your element for easier management.
- Run — submit to create your custom AI element.
- Save the element_id — use this ID in Kling video generation to apply the element.
Pricing
| Output | Cost |
|---|---|
| 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.
Related Models
- Kling Video O3 Pro Image-to-Video — Use created elements in video generation.
- Kling Video O3 Pro Reference-to-Video — Reference-based video generation.
- Kling V3.0 Pro Image-to-Video — High-quality image-to-video generation.
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
doneParameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| name | string | Yes | - | - | Element name, It cannot exceed 20 characters. |
| description | string | Yes | - | - | Element description, It cannot exceed 100 characters. |
| image | string | Yes | - | 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_list | array<string> | Yes | - | 0 ~ 3 items | Other reference list of the element. |
| voice_id | string | No | - | - | The voice ID of element can be bound to existing tone colors in the tone library. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Output values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Task status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses. |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction |
| data.model | string | Model ID used for the prediction |
| data.outputs | array<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.urls | object | Object containing related API endpoints |
| data.status | string | Status: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses |
| data.created_at | string | ISO timestamp of when the request was created |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |