## Basic tool info Model name: klingai/kling v4 flash reference Model description: Generate 5–20s 720p videos guided by reference images and clips. Keep characters and style consistent with up to 10 images and 5 videos. Model cover: https://cdn.wiro.ai/uploads/models/klingai-kling-v4-flash-reference-cover.mp4 Model categories: - tool - klingai - partner - image-to-video - nogpu-pipeline - video-to-video Run Task Endpoint (POST): https://api.wiro.ai/v1/Run/klingai/kling-v4-flash-reference Get Task Detail Endpoint (POST): https://api.wiro.ai/v1/Task/Detail ## Model Inputs: - name: inputImage label: First Frame help: Optional. First frame of the video. Counts toward the 10 image limit. type: combinefileinput default: - name: inputImageReference label: Reference Images help: Optional. Images for characters, objects, scenes or style. Up to 10 images in total, including the first frame. type: combinefileinput default: https://cdn.wiro.ai/uploads/sampleinputs/kling-v4-flash-r2v-sampleinput-1.webp - name: prompt label: Prompt help: Required. Describe how each input is used. Images are numbered @image_1, @image_2, ... (reference images first, then the first frame); videos are @video_1, @video_2, ... (reference videos first, then the base video). To edit a video, write "Edit @video_1" and say what to keep unchanged. type: textarea default: The macaw from @image_1 spreads its bright red, blue and yellow wings, takes off from the mossy branch and flies through the lush green rainforest, then lands on another branch and ruffles its feathers. Soft light through the leaves, the camera follows its flight. Wing flaps, birdsong and jungle ambience. - name: duration label: Duration help: Required. Total duration of the generated video in seconds, from 3 to 20. Output is 720p. type: select default: 3 options: - value: "3" label: 3 - value: "4" label: 4 - value: "5" label: 5 - value: "6" label: 6 - value: "7" label: 7 - value: "8" label: 8 - value: "9" label: 9 - value: "10" label: 10 - value: "11" label: 11 - value: "12" label: 12 - value: "13" label: 13 - value: "14" label: 14 - value: "15" label: 15 - value: "16" label: 16 - value: "17" label: 17 - value: "18" label: 18 - value: "19" label: 19 - value: "20" label: 20 - name: inputVideo label: Reference Videos help: Optional. Videos to reference for motion, camera movement or pacing. .mp4/.mov, 3-20s each, at least 700px per side. Up to 5 videos and 20s in total, including the base video. type: combinefileinput default: - name: inputVideoBase label: Base Video help: Optional. A video to edit. .mp4/.mov, 3-20s, at least 700px per side. Write "Edit @video_n" in the prompt and say what to change and what to keep. type: combinefileinput default: - name: ratio label: Ratio help: Optional. Default 9:16. Aspect ratio. adaptive follows the prompt, then the base video, then the first frame, then the reference videos, otherwise 16:9. type: select default: 9:16 options: - value: "adaptive" label: adaptive - value: "21:9" label: 21:9 - value: "16:9" label: 16:9 - value: "9:16" label: 9:16 - value: "1:1" label: 1:1 - name: audio label: Audio help: Optional. Default native. native makes new audio for the video. original keeps the audio of the base video, or of the first reference video when there is no base video. original needs a reference or base video; otherwise native is used. type: select default: native options: - value: "native" label: native - value: "original" label: original - name: watermark label: Watermark help: Optional. Default false. Whether to add a watermark to the result. type: select default: false options: - value: "false" label: false - value: "true" label: true ## Model Parameter Inspires: - prompt: The macaw from @image_1 spreads its bright red, blue and yellow wings, takes off from the mossy branch and flies through the lush green rainforest, then lands on another branch and ruffles its feathers. Soft light through the leaves, the camera follows its flight. Wing flaps, birdsong and jungle ambience. - inputImageReference: https://cdn.wiro.ai/uploads/sampleinputs/kling-v4-flash-r2v-sampleinput-1.webp - prompt: A hand unscrews the lid of the glowing glass jar of fireflies from @image_1 on the porch railing at dusk, and the fireflies drift out one by one, floating up and spreading over the dark meadow like tiny lights. Slow push-in, blue evening light. Crickets and a soft summer night breeze. - inputImageReference: https://cdn.wiro.ai/uploads/sampleinputs/kling-v4-flash-r2v-sampleinput-2.webp - prompt: The knight from @image_1 walks slowly through the misty pine forest, armor clinking, then stops in a beam of light, grips the hilt and slowly draws his sword, the blade catching the light. Cinematic low angle, drifting mist. Metal footsteps, the ring of the drawn sword and quiet forest sounds. - inputImageReference: https://cdn.wiro.ai/uploads/sampleinputs/kling-v4-flash-r2v-sampleinput-3.webp - prompt: The hiker from @image_1 climbs the last rocks to the mountain summit at sunrise, steps onto the top and raises both arms above a sea of clouds, smiling in the golden light. The camera rises behind her to reveal the view. Wind and a happy shout. - inputImageReference: https://cdn.wiro.ai/uploads/sampleinputs/kling-v4-flash-r2v-sampleinput-4.webp ## Integration Header Prepare ```bash # Sign up Wiro dashboard and create project export YOUR_API_KEY="YOUR_WIRO_API_KEY"; export YOUR_API_SECRET="XXXXXXXXX"; # unix time or any random integer value export NONCE=$(date +%s); # hmac-SHA256 (YOUR_API_SECRET+Nonce) with YOUR_API_KEY export SIGNATURE="$(echo -n "${YOUR_API_SECRET}${NONCE}" | openssl dgst -sha256 -hmac "${YOUR_API_KEY}" | awk '{print $NF}')"; ``` ## Run Command - Make HTTP Post Request ```bash curl -X POST "https://api.wiro.ai/v1/Run/klingai/kling-v4-flash-reference" \ -H "Content-Type: application/json" \ -H "x-api-key: ${YOUR_API_KEY}" \ -H "x-nonce: ${NONCE}" \ -H "x-signature: ${SIGNATURE}" \ --data-binary @- <<'JSON' { "inputImage": [], "inputImageReference": [ "https://cdn.wiro.ai/uploads/sampleinputs/kling-v4-flash-r2v-sampleinput-1.webp" ], "prompt": "The macaw from @image_1 spreads its bright red, blue and yellow wings, takes off from the mossy branch and flies through the lush green rainforest, then lands on another branch and ruffles its feathers. Soft light through the leaves, the camera follows its flight. Wing flaps, birdsong and jungle ambience.", "duration": "3", "inputVideo": [], "inputVideoBase": [], "ratio": "9:16", "audio": "native", "watermark": "false", "callbackUrl": "You can provide a callback URL; Wiro will send a POST request to it when the task is completed." } JSON ``` ## Run Command - Response ```json { "errors": [], "taskid": "2221", "socketaccesstoken": "eDcCm5yyUfIvMFspTwww49OUfgXkQt", "result": true } ``` ## Get Task Detail - Make HTTP Post Request with Task ID ```bash curl -X POST "https://api.wiro.ai/v1/Task/Detail" \ -H "Content-Type: application/json" \ -H "x-api-key: ${YOUR_API_KEY}" \ -H "x-nonce: ${NONCE}" \ -H "x-signature: ${SIGNATURE}" \ -d '{ "taskid": "2221" }'; ``` ## Get Task Detail - Make HTTP Post Request with Socket Access Token ```bash curl -X POST "https://api.wiro.ai/v1/Task/Detail" \ -H "Content-Type: application/json" \ -H "x-api-key: ${YOUR_API_KEY}" \ -H "x-nonce: ${NONCE}" \ -H "x-signature: ${SIGNATURE}" \ -d '{ "tasktoken": "eDcCm5yyUfIvMFspTwww49OUfgXkQt" }'; ``` ## Get Task Detail - Response ```json { "total": "1", "errors": [], "tasklist": [ { "id": "2221", "uuid": "15bce51f-442f-4f44-a71d-13c6374a62bd", "socketaccesstoken": "eDcCm5yyUfIvMFspTwww49OUfgXkQt", "parameters": {}, "debugoutput": "", "debugerror": "", "starttime": "1734513809", "endtime": "1734513813", "elapsedseconds": "6.0000", "status": "task_postprocess_end", "createtime": "1734513807", "canceltime": "0", "assigntime": "1734513807", "accepttime": "1734513807", "preprocessstarttime": "1734513807", "preprocessendtime": "1734513807", "postprocessstarttime": "1734513813", "postprocessendtime": "1734513814", "totalcost": "0.003510000000", "chargedcost": "0.002808000000", "discountamount": "0.000702000000", "outputs": [ { "id": "6bc392c93856dfce3a7d1b4261e15af3", "name": "0.png", "contenttype": "image/png", "parentid": "6c1833f39da71e6175bf292b18779baf", "uuid": "15bce51f-442f-4f44-a71d-13c6374a62bd", "size": "202472", "addedtime": "1734513812", "modifiedtime": "1734513812", "accesskey": "dFKlMApaSgMeHKsJyaDeKrefcHahUK", "url": "https://cdn1.wiro.ai/6a6af820-c5050aee-40bd7b83-a2e186c6-7f61f7da-3894e49c-fc0eeb66-9b500fe2/0.png" } ], "size": "202472" } ], "result": true } ``` totalcost is the list price. chargedcost is the amount actually billed after any discount (a store fee is included on store runs); discountamount is the discount. chargedcost is null until the charge is recorded (shortly after task_postprocess_end) and "0" for a failed or cancelled task. ## Kill Task - Make HTTP Post Request with Task ID ```bash curl -X POST "https://api.wiro.ai/v1/Task/Kill" \ -H "Content-Type: application/json" \ -H "x-api-key: ${YOUR_API_KEY}" \ -H "x-nonce: ${NONCE}" \ -H "x-signature: ${SIGNATURE}" \ -d '{ "taskid": "534574" }'; ``` ## Kill Task - Make HTTP Post Request with Socket Access Token ```bash curl -X POST "https://api.wiro.ai/v1/Task/Kill" \ -H "Content-Type: application/json" \ -H "x-api-key: ${YOUR_API_KEY}" \ -H "x-nonce: ${NONCE}" \ -H "x-signature: ${SIGNATURE}" \ -d '{ "socketaccesstoken": "ZpYote30on42O4jjHXNiKmrWAZqbRE" }'; ``` ## Kill Task - Response ```json { "errors": [], "tasklist": [ { "id": "534574", "uuid": "15bce51f-442f-4f44-a71d-13c6374a62bd", "name": "", "socketaccesstoken": "ZpYote30on42O4jjHXNiKmrWAZqbRE", "parameters": { "inputImage": "https://api.wiro.ai/v1/File/mCmUXgZLG1FNjjjwmbtPFr2LVJA112/inputImage-6060136.png" }, "debugoutput": "", "debugerror": "", "starttime": "1734513809", "endtime": "1734513813", "elapsedseconds": "6.0000", "status": "task_cancel", "cps": "0.000585000000", "totalcost": "0.003510000000", "guestid": null, "projectid": "699", "modelid": "598", "description": "", "basemodelid": "0", "runtype": "model", "modelfolderid": "", "modelfileid": "", "callbackurl": "", "marketplaceid": null, "createtime": "1734513807", "canceltime": "0", "assigntime": "1734513807", "accepttime": "1734513807", "preprocessstarttime": "1734513807", "preprocessendtime": "1734513807", "postprocessstarttime": "1734513813", "postprocessendtime": "1734513814", "pexit": "0", "categories": "["tool","image-to-image","quick-showcase","compare-landscape"]", "outputs": [ { "id": "6bc392c93856dfce3a7d1b4261e15af3", "name": "0.png", "contenttype": "image/png", "parentid": "6c1833f39da71e6175bf292b18779baf", "uuid": "15bce51f-442f-4f44-a71d-13c6374a62bd", "size": "202472", "addedtime": "1734513812", "modifiedtime": "1734513812", "accesskey": "dFKlMApaSgMeHKsJyaDeKrefcHahUK", "foldercount": "0", "filecount": "0", "ispublic": 0, "expiretime": null, "url": "https://cdn1.wiro.ai/6a6af820-c5050aee-40bd7b83-a2e186c6-7f61f7da-3894e49c-fc0eeb66-9b500fe2/0.png" } ], "size": "202472" } ], "result": true } ``` ## Cancel Task - Make HTTP Post Request (For tasks on queue) ```bash curl -X POST "https://api.wiro.ai/v1/Task/Cancel" \ -H "Content-Type: application/json" \ -H "x-api-key: ${YOUR_API_KEY}" \ -H "x-nonce: ${NONCE}" \ -H "x-signature: ${SIGNATURE}" \ -d '{ "taskid": "634574" }'; ``` ## Cancel Task - Response ```json { "errors": [], "tasklist": [ { "id": "634574", "uuid": "15bce51f-442f-4f44-a71d-13c6374a62bd", "name": "", "socketaccesstoken": "ZpYote30on42O4jjHXNiKmrWAZqbRE", "parameters": { "inputImage": "https://api.wiro.ai/v1/File/mCmUXgZLG1FNjjjwmbtPFr2LVJA112/inputImage-6060136.png" }, "debugoutput": "", "debugerror": "", "starttime": "1734513809", "endtime": "1734513813", "elapsedseconds": "6.0000", "status": "task_cancel", "cps": "0.000585000000", "totalcost": "0.003510000000", "guestid": null, "projectid": "699", "modelid": "598", "description": "", "basemodelid": "0", "runtype": "model", "modelfolderid": "", "modelfileid": "", "callbackurl": "", "marketplaceid": null, "createtime": "1734513807", "canceltime": "0", "assigntime": "1734513807", "accepttime": "1734513807", "preprocessstarttime": "1734513807", "preprocessendtime": "1734513807", "postprocessstarttime": "1734513813", "postprocessendtime": "1734513814", "pexit": "0", "categories": "["tool","image-to-image","quick-showcase","compare-landscape"]", "outputs": [ { "id": "6bc392c93856dfce3a7d1b4261e15af3", "name": "0.png", "contenttype": "image/png", "parentid": "6c1833f39da71e6175bf292b18779baf", "uuid": "15bce51f-442f-4f44-a71d-13c6374a62bd", "size": "202472", "addedtime": "1734513812", "modifiedtime": "1734513812", "accesskey": "dFKlMApaSgMeHKsJyaDeKrefcHahUK", "foldercount": "0", "filecount": "0", "ispublic": 0, "expiretime": null, "url": "https://cdn1.wiro.ai/6a6af820-c5050aee-40bd7b83-a2e186c6-7f61f7da-3894e49c-fc0eeb66-9b500fe2/0.png" } ], "size": "202472" } ], "result": true } ``` ## Task Status Information This section defines the possible task status values returned by the API when polling for task completion. ### Completed Task Statuses (Polling can stop) These indicate that the task has reached a terminal state — either success or failure. Once any of these is received, polling should stop. - task_postprocess_end : Task completed successfully and post-processing is done. - task_cancel : Task was cancelled by the user or system. ### Running Task Statuses (Continue polling) These statuses indicate that the task is still in progress. Polling should continue if one of these is returned. - task_queue : Task is waiting in the queue. - task_accept : Task has been accepted for processing. - task_assign : Task is being assigned to a worker. - task_preprocess_start : Preprocessing is starting. - task_preprocess_end : Preprocessing is complete. - task_start : Task execution has started. - task_output : Output is being generated.