{"title":"Kling Video 4.0 Reference-to-Video","slug":"kling-video-4-0-reference-to-video","version":"0.0.1","output_type":"video","request_schema":{"additionalProperties":false,"properties":{"aspect_ratio":{"default":"adaptive","description":"Output frame aspect ratio.","enum":["21:9","16:9","9:16","1:1","adaptive"],"title":"Aspect Ratio","type":"string"},"duration":{"default":10,"description":"Output video duration in seconds.","enum":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"title":"Duration","type":"integer"},"elements":{"description":"Up to 7 Elements, at most 3 Video Character Elements; videos plus Video Character Elements must not exceed 5. Images, videos and Elements combined must not exceed 15. Element type and associated-video duration constraints are provider-enforced.","items":{"additionalProperties":false,"properties":{"element_id":{"description":"Existing Kling Element ID returned by the Element API; supports Multi-image and Video Character Elements.","minLength":1,"type":"string"},"id":{"description":"Reference identifier used in the prompt; unique across this task.","minLength":1,"type":"string"}},"required":["element_id","id"],"type":"object"},"maxItems":7,"minItems":0,"title":"Reference Elements","type":"array"},"images":{"description":"Up to 10 JPG/JPEG/PNG images, each at most 30 MB, minimum 300px per dimension, aspect ratio 2:5–5:2. Multiple middle_frame or refer_image entries require ids. All supplied reference ids must be unique across images, videos and Elements. Media constraints are provider-enforced.","items":{"additionalProperties":false,"properties":{"id":{"description":"Optional image identifier for prompt references, unique within this task.","minLength":1,"type":"string"},"type":{"description":"Image keyframe role.","enum":["first_frame","middle_frame","last_frame","refer_image"],"type":"string"},"url":{"description":"Image URL or Base64 image content. JPG/JPEG/PNG, at most 30 MB, minimum 300 x 300 pixels, aspect ratio 2:5 to 5:2. Media constraints are enforced by Kling.","format":"uri","minLength":1,"type":"string"}},"required":["type","url"],"type":"object"},"maxItems":10,"minItems":0,"title":"Reference Images and Keyframes","type":"array"},"prompt":{"description":"Required video prompt, including any negative descriptions. English-only: 26,000 characters; non-English-only: 11,000. Mixed input: E/26000 + N/11000 \u003c= 1; language-weighted limit is provider-enforced.","maxLength":26000,"minLength":1,"title":"Prompt","type":"string"},"resolution":{"default":"1080p","description":"Output video resolution.","enum":["720p","1080p"],"title":"Resolution","type":"string"},"videos":{"description":"Up to 5 reference videos, with at most one base_video. When Video Character Elements are included, videos plus those Elements must not exceed 5. Element-dependent constraints are provider-enforced.","items":{"additionalProperties":false,"properties":{"id":{"description":"Reference identifier used in the prompt; unique across this task.","minLength":1,"type":"string"},"type":{"enum":["feature_video","base_video"],"type":"string"},"url":{"description":"MP4/MOV URL; at most 300 MB; 3–30s; each dimension 700–4553px, at most 8,294,400 pixels, aspect ratio 2:5–5:2; 24–60fps. Total video duration including Video Character Elements is 3–30s. Media constraints are provider-enforced.","format":"uri","pattern":"^https?://","type":"string"}},"required":["type","url"],"type":"object"},"maxItems":5,"minItems":0,"title":"Reference Videos","type":"array"},"voices":{"description":"Up to 3 existing custom or system voice references. Reference ids must be unique across all input types. All references combined must not exceed 15.","items":{"additionalProperties":false,"properties":{"id":{"description":"Unique reference id used in the prompt.","minLength":1,"type":"string"},"voice_id":{"description":"Existing custom or system preset voice ID.","minLength":1,"type":"string"}},"required":["voice_id","id"],"type":"object"},"maxItems":3,"minItems":0,"title":"Voice References","type":"array"}},"required":["prompt"],"type":"object"},"openapi_schema":{"components":{"schemas":{"Error":{"properties":{"details":{"description":"Optional validation or request details for client errors.","nullable":true},"error":{"description":"Safe user-facing error message.","type":"string"},"status":{"description":"HTTP status code, when returned by the shared error handler.","type":"integer"}},"required":["error"],"type":"object"},"KlingVideo40ReferenceToVideoInput":{"additionalProperties":false,"properties":{"aspect_ratio":{"default":"adaptive","description":"Output frame aspect ratio.","enum":["21:9","16:9","9:16","1:1","adaptive"],"title":"Aspect Ratio","type":"string"},"duration":{"default":10,"description":"Output video duration in seconds.","enum":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"title":"Duration","type":"integer"},"elements":{"description":"Up to 7 Elements, at most 3 Video Character Elements; videos plus Video Character Elements must not exceed 5. Images, videos and Elements combined must not exceed 15. Element type and associated-video duration constraints are provider-enforced.","items":{"additionalProperties":false,"properties":{"element_id":{"description":"Existing Kling Element ID returned by the Element API; supports Multi-image and Video Character Elements.","minLength":1,"type":"string"},"id":{"description":"Reference identifier used in the prompt; unique across this task.","minLength":1,"type":"string"}},"required":["element_id","id"],"type":"object"},"maxItems":7,"minItems":0,"title":"Reference Elements","type":"array"},"images":{"description":"Up to 10 JPG/JPEG/PNG images, each at most 30 MB, minimum 300px per dimension, aspect ratio 2:5–5:2. Multiple middle_frame or refer_image entries require ids. All supplied reference ids must be unique across images, videos and Elements. Media constraints are provider-enforced.","items":{"additionalProperties":false,"properties":{"id":{"description":"Optional image identifier for prompt references, unique within this task.","minLength":1,"type":"string"},"type":{"description":"Image keyframe role.","enum":["first_frame","middle_frame","last_frame","refer_image"],"type":"string"},"url":{"description":"Image URL or Base64 image content. JPG/JPEG/PNG, at most 30 MB, minimum 300 x 300 pixels, aspect ratio 2:5 to 5:2. Media constraints are enforced by Kling.","format":"uri","minLength":1,"type":"string"}},"required":["type","url"],"type":"object"},"maxItems":10,"minItems":0,"title":"Reference Images and Keyframes","type":"array"},"prompt":{"description":"Required video prompt, including any negative descriptions. English-only: 26,000 characters; non-English-only: 11,000. Mixed input: E/26000 + N/11000 \u003c= 1; language-weighted limit is provider-enforced.","maxLength":26000,"minLength":1,"title":"Prompt","type":"string"},"resolution":{"default":"1080p","description":"Output video resolution.","enum":["720p","1080p"],"title":"Resolution","type":"string"},"videos":{"description":"Up to 5 reference videos, with at most one base_video. When Video Character Elements are included, videos plus those Elements must not exceed 5. Element-dependent constraints are provider-enforced.","items":{"additionalProperties":false,"properties":{"id":{"description":"Reference identifier used in the prompt; unique across this task.","minLength":1,"type":"string"},"type":{"enum":["feature_video","base_video"],"type":"string"},"url":{"description":"MP4/MOV URL; at most 300 MB; 3–30s; each dimension 700–4553px, at most 8,294,400 pixels, aspect ratio 2:5–5:2; 24–60fps. Total video duration including Video Character Elements is 3–30s. Media constraints are provider-enforced.","format":"uri","pattern":"^https?://","type":"string"}},"required":["type","url"],"type":"object"},"maxItems":5,"minItems":0,"title":"Reference Videos","type":"array"},"voices":{"description":"Up to 3 existing custom or system voice references. Reference ids must be unique across all input types. All references combined must not exceed 15.","items":{"additionalProperties":false,"properties":{"id":{"description":"Unique reference id used in the prompt.","minLength":1,"type":"string"},"voice_id":{"description":"Existing custom or system preset voice ID.","minLength":1,"type":"string"}},"required":["voice_id","id"],"type":"object"},"maxItems":3,"minItems":0,"title":"Voice References","type":"array"}},"required":["prompt"],"type":"object","x-eachlabs-order-properties":["prompt","images","videos","elements","voices","duration","resolution","aspect_ratio"]}},"securitySchemes":{"bearerAuth":{"description":"API key passed as `Authorization: Bearer \u003capi_key\u003e`","scheme":"bearer","type":"http"}}},"info":{"description":"Kling Video 4.0 Reference-to-Video creates videos from image, video and Element references. Choose 3–30 seconds at 720p or 1080p for creative and social clips.","title":"Kling Video 4.0 Reference-to-Video","version":"1.0.0","x-eachlabs-model-slug":"kling-video-4-0-reference-to-video","x-eachlabs-output-type":"video"},"openapi":"3.0.4","paths":{"/v1/prediction":{"post":{"description":"Creates a new prediction for Kling Video 4.0 Reference-to-Video.","operationId":"createPrediction","requestBody":{"content":{"application/json":{"schema":{"properties":{"input":{"$ref":"#/components/schemas/KlingVideo40ReferenceToVideoInput"},"model":{"description":"Model slug or identifier.","enum":["kling-video-4-0-reference-to-video"],"type":"string"},"webhook_secret":{"description":"Optional secret used to sign webhook requests.","type":"string"},"webhook_url":{"description":"Optional webhook URL to receive the prediction result asynchronously.","format":"uri","type":"string"}},"required":["model","input"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"message":{"description":"Human-readable message about the prediction creation.","type":"string"},"predictionID":{"description":"Unique prediction identifier.","type":"string"},"status":{"description":"Status of the prediction creation request.","example":"success","type":"string"}},"type":"object"}}},"description":"Prediction created successfully."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request."},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal server error."}},"summary":"Create a prediction"}},"/v1/prediction/{id}":{"get":{"description":"Retrieves the status and results of a prediction by its ID.","operationId":"getPrediction","parameters":[{"description":"Prediction ID.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"fallback":{"description":"Present when the request selected a fallback config. Status stays non-terminal until the requested model or a fallback model ends the request.","properties":{"requested_model":{"description":"Model the request named.","nullable":true,"type":"string"},"resolved":{"description":"False while a model in the chain is still running.","type":"boolean"},"selector":{"description":"Fallback config the request selected.","type":"string"},"served_by":{"description":"Model whose result this prediction returns; null until resolved.","nullable":true,"type":"string"},"used":{"description":"True once a fallback model ran because the requested model failed.","type":"boolean"}},"type":"object"},"id":{"description":"Unique prediction identifier.","type":"string"},"input":{"additionalProperties":true,"description":"Input parameters used for the prediction.","type":"object"},"logs":{"description":"Execution logs from the prediction.","nullable":true,"type":"string"},"metrics":{"description":"Performance and cost metrics.","properties":{"cost":{"description":"Cost of the prediction in USD.","type":"number"},"predict_time":{"description":"Time taken for prediction in seconds.","type":"number"}},"type":"object"},"output":{"description":"Prediction output (output_type: video).","nullable":true,"oneOf":[{"type":"string"},{"items":{},"type":"array"},{"type":"object"}]},"status":{"description":"Current status of the prediction.","enum":["created","starting","processing","success","error","cancelled"],"type":"string"},"urls":{"description":"Related API endpoints.","properties":{"cancel":{"description":"URL to cancel the prediction.","format":"uri","type":"string"},"get":{"description":"URL to get the prediction.","format":"uri","type":"string"}},"type":"object"}},"type":"object"}}},"description":"Prediction retrieved successfully."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Prediction not found."},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal server error."}},"summary":"Get a prediction"}},"/v1/prediction/{id}/cancel":{"post":{"description":"Cancels a running prediction by ID. Cancellation is record-only: the execution record is set to cancelled and no upstream cancellation is attempted — in-flight provider work runs to completion and its result is discarded.","operationId":"cancelPrediction","parameters":[{"description":"Prediction ID.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"message":{"description":"Human-readable cancellation message.","type":"string"},"predictionID":{"description":"Unique prediction identifier.","type":"string"},"status":{"description":"Cancellation status returned when the request succeeds.","enum":["success"],"type":"string"}},"type":"object"}}},"description":"Prediction cancelled."},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Prediction not found."},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal server error."}},"summary":"Cancel a prediction"}}},"security":[{"bearerAuth":[]}],"servers":[{"url":"https://api.eachlabs.ai"}]},"cost":{"currency":"USD","type":"usage_based","amount":null,"unit":"second","estimate":"$0.094–$0.235 per second, depending on resolution and videos and elements and duration","description":"Pricing is an estimate and may change as rates are updated.","min":0.094,"max":0.235,"depends_on":["resolution","videos","elements","duration"],"rows":[{"label":"720p | No input video","value":0.157},{"label":"720p | With input video","value":0.094},{"label":"1080p | No input video","value":0.235},{"label":"1080p | With input video","value":0.141}]}}
