Image to Video
Generate a video that starts from your image as the first frame (Kling 4.0 Flash image_to_video).
Kling 4.0 Flash starts the video from your image as the first frame and generates what happens next.
Create a task
https://api.nanoapi.ai/v1/tasksUse the shared create endpoint with model: "kling-4.0-flash" and mode: "image_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 | image_to_video |
image_urls | string[] | Yes | Exactly 1 image: the first frame. 2 or more return 400 invalid_request. See Media. |
prompt | string | No | How the scene should change, at most 8000 characters. Refer to the image as @Image1, see Referring to files. |
aspect_ratio | string | Yes | auto, 21:9, 16:9, 9:16 or 1:1. auto follows the first frame. |
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. |
A first frame, 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": "image_to_video",
"image_urls": ["https://example.com/first_frame.jpg"],
"prompt": "The cat slowly turns its head and looks at the camera",
"aspect_ratio": "auto",
"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…
Billed seconds are the duration you ask for. 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 image_to_video). 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.