Kling 4 Video
Create Kling 4 Omni and ordered-keyframe videos through the SJinn REST API
Create a task
Send POST https://sjinn.ai/api/un-api/create_tool_task with an API token in Authorization: Bearer <token> and a JSON body containing tool_type and input. An active membership and sufficient credits are required.
| Tool type | Operation |
|---|---|
kling4-omni-video-api | Generate from a prompt with optional reference images and videos |
kling4-image-to-video-api | Animate a required first frame with optional intermediate and last frames |
Both tools share these parameters:
| Input | Default | Rules |
|---|---|---|
duration | 5 | Whole seconds from 3 to 30 |
resolution | "720p" | "720p" or "1080p" |
720p costs 225 credits per output second; 1080p costs 330 credits per output second. A five-second video costs 1,125 or 1,650 credits respectively. Reference-video duration does not add output seconds to the bill.
All media values must be complete HTTP(S) URLs without embedded credentials. REST accepts signed and temporary URLs and preserves their query strings; keep them accessible long enough for the provider to read them. Public MCP has a separate stable-URL requirement.
Unknown input fields are rejected. Neither tool accepts model, mode, multi_shot, multi-shot, audio_urls, media_urls, provider, webhook, or client-supplied billing values. Content checks apply to enrolled users before generation is billed.
Omni inputs
| Input | Required | Rules |
|---|---|---|
prompt | Yes | Nonblank text, at most 8,000 characters |
image_urls | No | Up to 10 reference images; defaults to [] |
video_urls | No | Up to 5 reference videos; defaults to [] |
aspect_ratio | No | 16:9, 9:16, 1:1, 21:9, or auto; defaults to 16:9 |
References such as @Image1 / @image_1 and @Video1 / @video_1 are one-based and must refer to a supplied asset. The server verifies each reference video's duration before charging: each must be 3–30 seconds and their combined duration must be at most 30 seconds.
{
"tool_type": "kling4-omni-video-api",
"input": {
"prompt": "Animate @Image1 as the camera moves through the forest",
"image_urls": ["https://example.com/forest.png"],
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}
}
Frames inputs
| Input | Required | Rules |
|---|---|---|
first_frame_url | Yes | First-frame image URL |
last_frame_url | No | Last-frame image URL; omit when unused |
keyframe_urls | No | Intermediate images in chronological order, excluding the first and last frames; defaults to [] |
prompt | No | If provided, nonblank text of at most 8,000 characters |
Total frames, including the first and any last frame, must not exceed min(10, duration + 1). For a three-second video with both first and last frames, at most two intermediate frames are allowed. Frames does not accept aspect_ratio, image_urls, or video_urls; use the frame fields directly. The CLI maps --image and --end-image to first_frame_url and last_frame_url.
{
"tool_type": "kling4-image-to-video-api",
"input": {
"first_frame_url": "https://example.com/start.png",
"keyframe_urls": ["https://example.com/middle-1.png", "https://example.com/middle-2.png"],
"last_frame_url": "https://example.com/end.png",
"duration": 5,
"resolution": "1080p"
}
}
Polling and failures
A successful create response contains the SJinn task ID:
{"success":true,"errorMsg":"","error_code":0,"data":{"task_id":"<task-id>"}}
Poll GET /api/un-api/query_tool_task_status?task_id=<task-id> with the same Authorization header, or POST {"task_id":"<task-id>"} to that route. Only the task owner can query it. data.status is 0 for pending, 1 for success, or 2 for failure. Successful tasks include data.output_urls; failures include data.error. The response's top-level success indicates whether the query itself succeeded.
Validation, content-check and reference-duration failures occur before debit. A definite creation rejection refunds the original debit; failed-generation callbacks refund it once. A timeout, unclear submission response, or accepted provider task whose mapping could not be saved remains pending for reconciliation, without an automatic refund or another submission.
Disable automatic network retries for both create requests. A lost response may still represent a paid task. If a task ID was received, poll it; otherwise reconcile the original request before submitting again. The create API does not provide request-level idempotency.
