Generate a Kling 4.0 video
type reference-to-video covers text-only prompts and reference images, videos, subjects (elements), and voices. type keyframe-to-video interpolates between a first frame, optional middle frames, and a last frame.
Rules: at most 15 references in total and at most 5 videos per request; reference videos and video subjects together are capped at 30 seconds. A keyframe request allows at most duration + 1 frames, up to 10. Refer to references in the prompt by name (@image_1, @video_1, a subject's or voice's name, @first_frame, @keyframe_1, @last_frame); a mention that matches no reference is rejected before charging.
Request
- Base URLhttps://www.seedance2ai.io
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Headers
Strongly recommended on every POST. Once a request has created (and charged for) a task, a retry with the same key and the same body within 24 hours replays that response instead of creating a second paid task. Errors raised before anything was charged, such as insufficient_credits or service_busy, are not replayed, so after fixing the cause the same key runs the request again. Reusing a key with a different body, or while the first request is still running, returns idempotency_conflict (HTTP 409). Surrounding whitespace is trimmed; keys longer than 120 characters are ignored, which disables the protection.
Request body
Response
Task accepted. Poll GET /api/v1/tasks/{id} with the returned id (prefix sd2_) until status is completed or failed, and read the files from result_urls there.
Changes
No recorded changes to this operation across all 1 revision of this API.