Quotaflow
llms.txtOpenAPIDashboard
Model Library

Kling 4.0 — video API

Use kuaishou/kling-4.0 for Kling text-to-video, or image-to-video from a first frame, at 720p or 1080p through the Quotaflow /openai/v1/videos task API: create a task, store the returned id, and poll until the task completes. It uses the same API as the other video models; compare them on the Videos page.

Kling, Wan, Seedance, and Veo are different video model families. kuaishou/kling-4.0 is never used as a fallback for another family's model, and no other model stands in for it.

Model contract

PropertyValue
Model idkuaishou/kling-4.0, as /models lists it (kling-4.0 is also accepted)
EndpointPOST https://api.quotaflow.ai/openai/v1/videos
Status endpointGET https://api.quotaflow.ai/openai/v1/videos/{task_id}
Content endpointGET https://api.quotaflow.ai/openai/v1/videos/{task_id}/content
durationSeconds3–30; default 5
resolution720p or 1080p; default 720p
aspect_ratio16:9, 9:16, 1:1, or 21:9; default 16:9 (text-to-video only)
Modestext_to_video (the default), image_to_video (with first_frame_url)
first_frame_urlBase64 data URL of the first frame; makes the task image_to_video

Call /models with your production key before launch. Video access is key-enabled: the default all-model key has it. Only a key with access to the Kling video line lists kuaishou/kling-4.0.

Text-to-video example

curl https://api.quotaflow.ai/openai/v1/videos \
  -H "Authorization: Bearer $QUOTAFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kuaishou/kling-4.0",
    "prompt": "A paper boat drifting across a still pond at sunrise, slow camera pan.",
    "durationSeconds": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "max_cost_usd": 2
  }'

First-frame example

Send a first frame and the task is image_to_video (omit mode, or send image_to_video). Frames are Base64 data URLs; an https:// image link is refused. The video takes its aspect ratio from the image, so do not send aspect_ratio with a frame.

curl https://api.quotaflow.ai/openai/v1/videos \
  -H "Authorization: Bearer $QUOTAFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kuaishou/kling-4.0",
    "mode": "image_to_video",
    "prompt": "Keep the product shape and color consistent, slow camera push-in.",
    "first_frame_url": "data:image/png;base64,iVBORw0KGgo...",
    "durationSeconds": 5,
    "resolution": "720p",
    "max_cost_usd": 2
  }'

Poll the task

curl https://api.quotaflow.ai/openai/v1/videos/$TASK_ID \
  -H "Authorization: Bearer $QUOTAFLOW_API_KEY"

Download the completed video

curl -L https://api.quotaflow.ai/openai/v1/videos/$TASK_ID/content \
  -H "Authorization: Bearer $QUOTAFLOW_API_KEY" \
  --output kling.mp4

The content endpoint redirects to the video file; add ?format=json to receive { "url", "expires_at" } instead.

Notes

Next steps