Kling 4.0 Keyframe To Video
Endpoint
POST /videos/generations
Full URL: https://modelfold.ai/v1/videos/generations
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
Send model parameters directly in the JSON body. Do not wrap them in input. This request waits for generation to finish and returns data[].url; supported media models also offer async jobs, polling and callbacks. Replace example media URLs with your own publicly accessible files. See API gateway for billing and errors.
Input parameters for the generation task.
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The name of the model used to generate the task. This field is required. - This endpoint requires the kling-4.0/keyframe-to-video model Default:"kling-4.0/keyframe-to-video"。 Allowed values:kling-4.0/keyframe-to-video。 Example:kling-4.0/keyframe-to-video。 |
prompt | string | Yes | Prompt required by the ModelFold gateway; at most 2000 characters. Video description. Required. Maximum 8000 characters. Use @first_frame, @keyframe_1, @keyframe_2, …, @last_frame to mention frames that you uploaded in this request. You can only mention frames that are actually provided.Every @ mention must match an asset included in this request, otherwise the request is rejected. Mentions use longest-match against declared names. If the matched name ends with a letter, digit, or underscore, the next character cannot be a letter, digit, or underscore. minLength: 1. maxLength: 2000. Example:The girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frame。 |
duration | integer | No | Output video duration in seconds. Integer from 3 to 30. Default: 5.Also caps the total number of frames (first + middle + last): - 3 s → 4 frames - 4 s → 5 frames - 5 s → 6 frames - 6 s → 7 frames - 7 s → 8 frames - 8 s → 9 frames - 9 s or longer → 10 frames Default: 5。 minimum: 3. maximum: 30. Example:5。 |
resolution | string | No | Output resolution. 720p or 1080p. Default: 720p. Default:"720p"。 Allowed values:720p / 1080p。 Example:720p。 |
aspect_ratio | string | No | Output aspect ratio. Only used when no frame is provided (text-to-video); default is 16:9. If any frame is provided, the output follows the first frame's aspect ratio. Allowed values:auto / 16:9 / 9:16 / 1:1 / 21:9。 Example:auto。 |
first_frame_url | string | No | First-frame image URL. Mention it in the prompt as @first_frame. pattern: ^https?://. |
keyframe_urls | array<string> | No | Middle-frame image URLs, in chronological order. Up to 8 images, also limited by duration. Mention them in the prompt as @keyframe_1, @keyframe_2, …. Default:[]。 maxItems: 8. |
last_frame_url | string | No | Last-frame image URL. Mention it in the prompt as @last_frame. pattern: ^https?://. |
Request Example
bash
curl -X POST "https://modelfold.ai/v1/videos/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0/keyframe-to-video",
"prompt": "The girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frame",
"duration": 5,
"resolution": "720p",
"keyframe_urls": [
"https://example.com/reference.png"
]
}'json
{
"model": "kling-4.0/keyframe-to-video",
"prompt": "The girl in @first_frame walks out, passes the street in @keyframe_1, and arrives at the party in @last_frame",
"duration": 5,
"resolution": "720p",
"keyframe_urls": [
"https://example.com/reference.png"
]
}Response
200 — Generation completed. usage contains actual billing details; result URLs are illustrative.
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.mp4"
}
],
"usage": {}
}