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. Describe the video to generate. 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
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 character in @first_frame gently turns toward the camera.",
"duration": 3,
"resolution": "720p",
"first_frame_url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-tob-release-note/ch12_2_dark_hair_fighter_ref.png"
}'{
"model": "kling-4.0/keyframe-to-video",
"prompt": "The character in @first_frame gently turns toward the camera.",
"duration": 3,
"resolution": "720p",
"first_frame_url": "https://p2-kling.klingai.com/kcdn/cdn-kcdn112452/kling-tob-release-note/ch12_2_dark_hair_fighter_ref.png"
}Billing and defaults
- Both routes use the same public fields and pricing. Omitted
duration/resolutionmean 5 seconds / 720p. No frames is valid text-to-video; the official route uses its omni endpoint for that case. With frames,aspect_ratiois ignored. - Without video input: credits = ceil(rate × output seconds × current pricing multiplier). The base rate is 28.5 credits/second at 720p or 42.5 at 1080p. At the current multiplier, 3 seconds at 720p costs 112 credits; 5 seconds costs 186. Prices can change; use the quote returned by the service.
- Audio is generated natively; there is no audio-off parameter.
The response below illustrates a 3-second 720p request. usage.credits is charged credits; balance is the remaining balance; latencyMs is request time in milliseconds. rate, seconds, resolution and source describe the quote; reference generation also returns inputSeconds, and video input adds inputVideos. Values and optional fields vary by request. created is a Unix timestamp in seconds; data contains downloadable video URLs.
Response
200 — Generation completed. usage contains actual billing details; result URLs are illustrative.
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.mp4"
}
],
"usage": {
"credits": 112,
"rate": 28.5,
"seconds": 3,
"resolution": "720p",
"source": "rate",
"balance": 888,
"latencyMs": 120000
}
}