Get Started
Integrate this model into your application with a few lines of code.
You need an API key to use this model.
Example request
A complete request you can copy and run in your language of choice.
# The media URL below is a placeholder. Point it at your own publicly
# reachable file before running this.
# 1. Submit
SUBMIT=$(curl -sS --fail-with-body https://api.nunchux.ai/v1/klingai/omni-video/kling-4.0 \
-H "Authorization: Bearer $NUNCHUX_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: YourApp/1.0" \
-d '{
"contents": [
{
"type": "prompt",
"text": "The woman in @image_2 rides the red scooter from @image_1 along the winding canyon road in @image_3, her scarf streaming behind her, camera tracking alongside then pulling ahead, warm golden-hour light, engine purr and wind, her expression relaxed and natural, a soft easy smile"
},
{
"type": "refer_image",
"url": "https://example.com/example.jpg",
"id": "image_1"
}
],
"settings": {
"resolution": "720p",
"duration": 5
}
}') || { echo "submit failed: $SUBMIT" >&2; exit 1; }
TASK=$(jq -er '.data.id' <<<"$SUBMIT") || { echo "no task id in: $SUBMIT" >&2; exit 1; }
# 2. Poll until the task reaches a terminal status
DELAY=5
TERMINAL=0
for _ in $(seq 1 90); do
RESP=$(curl -sS https://api.nunchux.ai/v1/klingai/videos/omni-video/$TASK \
-H "Authorization: Bearer $NUNCHUX_API_KEY" \
-H "User-Agent: YourApp/1.0")
STATUS=$(jq -r '.data.task_status' <<<"$RESP")
case "$STATUS" in succeed|failed) TERMINAL=1; break ;; esac
sleep "$DELAY"; DELAY=$(( DELAY * 2 > 30 ? 30 : DELAY * 2 ))
done
[ "$TERMINAL" = 1 ] || { echo "timed out (last status: $STATUS)" >&2; exit 1; }
# 3. Check for failure
[ "$STATUS" = "succeed" ] || { echo "Kling: status $STATUS, not succeed: $(jq -c '.data.task_status_msg // empty' <<<"$RESP")" >&2; exit 1; }
# 4. Download
curl -sSL -o kling.mp4 "$(jq -r '.data.task_result.videos[0].url' <<<"$RESP")"