Reference to Video
Put the people, objects or scenes in your images into a new video, optionally guided by reference videos (Kling 4.0 Flash reference_to_video).
Kling 4.0 Flash puts the people, objects or scenes in your reference images into a newly generated video. You can also add reference videos, for example for the subject to copy the moves in one.
Create a task
https://api.nanoapi.ai/v1/tasksUse the shared create endpoint with model: "kling-4.0-flash" and mode: "reference_to_video".
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <API key>, see Authentication. |
Content-Type | Yes | application/json |
Idempotency-Key | No | A unique string for every new task, ideally a UUID (1–255 characters). See Preventing duplicate tasks. |
Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | kling-4.0-flash |
mode | string | Yes | reference_to_video |
image_urls | string[] | Conditional | At least one of image_urls and video_urls. Up to 10 reference images. See Media. |
video_urls | string[] | Conditional | At least one of image_urls and video_urls (reference videos alone are fine). Up to 5 reference videos, each 3–30 seconds, together at most 30 seconds, 720p or higher, aspect ratio at most 2.5:1, see Media. With reference videos the task is billed at the video_edit price, see Pricing. |
prompt | string | No | What the video shows, for example what the subject of the images does, at most 8000 characters. Refer to the files as @Image1, @Video1 and so on, see Referring to files. |
aspect_ratio | string | Yes | auto, 21:9, 16:9, 9:16 or 1:1. auto doesn't follow the reference images: if you need a particular ratio (for example portrait), set it. |
resolution | string | Yes | 720p. |
duration | integer | Yes | Output length in seconds, 3–20. Billed per second, see Pricing. |
webhook_url | string | No | Notified when the task succeeds or fails: https, up to 2048 characters, not a private, loopback or reserved address. See Webhooks. |
Two reference images, portrait, 5 seconds:
curl https://api.nanoapi.ai/v1/tasks \
-H "Authorization: Bearer $NANOAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0-flash",
"mode": "reference_to_video",
"image_urls": [
"https://example.com/cat.jpg",
"https://example.com/car.jpg"
],
"prompt": "The cat sits on the hood of the car",
"aspect_ratio": "9:16",
"resolution": "720p",
"duration": 5
}'A reference image and a reference video (the cat walks like the woman in the video), 16:9, 5 seconds:
curl https://api.nanoapi.ai/v1/tasks \
-H "Authorization: Bearer $NANOAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-4.0-flash",
"mode": "reference_to_video",
"image_urls": ["https://example.com/cat.jpg"],
"video_urls": ["https://example.com/walk.mp4"],
"prompt": "The cat from @Image1 walks down the street like the woman in @Video1",
"aspect_ratio": "16:9",
"resolution": "720p",
"duration": 5
}'Response: 200 OK, the new task (fields). Keep data.id to get the result; the task can still fail, see Errors.
{
"code": 200,
"message": "success",
"data": {
"object": "task",
"id": "tk_01jbm3r8x5c2v9b6n4q7w1e3t5",
"model": "kling-4.0-flash",
"status": "queued",
"error": null,
"created_at": "2026-11-18T08:30:00Z"
}
}Pricing
cost = duration × price per secondLoading the current prices…
With reference videos (video_urls) the task is billed at the video_edit price per second instead. The second request above (5 seconds) costs 5 × the video_edit price per second:
Loading the current prices…
Billed seconds are the duration you ask for, however many images or videos you send and however long the videos are. All Kling 4.0 Flash prices: Kling 4.0 Flash → Pricing. Current prices: GET /v1/products (product kling_flash, the prices row whose mode is reference_to_video; with reference videos, the video_edit row). The task's billing.frozen is the amount that counts; freezing and charging: Billing.
Errors
See Kling 4.0 Flash → Errors. This mode's parameter rules are in the table above.