Skip to content

Kling Video

Kling Video uses an asynchronous video task API. Create a task first, then poll the task endpoint for status and the final video URL.

Endpoints

Unified Video API

CapabilityMethodPath
Create video taskPOST/v1/video/generations
Retrieve video taskGET/v1/video/generations/{task_id}

Kling-Compatible API

CapabilityMethodPath
Text to videoPOST/kling/v1/videos/text2video
Image to videoPOST/kling/v1/videos/image2video
Retrieve text-to-video taskGET/kling/v1/videos/text2video/{task_id}
Retrieve image-to-video taskGET/kling/v1/videos/image2video/{task_id}

Every request requires an API key:

http
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Models

Model
kling-v3

Actual availability depends on your account permissions.

Unified API Request Parameters

FieldTypeRequiredDescription
modelstringYesKling model name
promptstringYesVideo generation prompt
imagestringNoFirst-frame image URL. When provided, the request is handled as image-to-video
modestringNoGeneration mode, such as std or pro. Defaults to std
durationnumberNoVideo duration in seconds. Defaults to 5
sizestringNoSize used to infer aspect ratio, such as 1920x1080, 1080x1920, 1024x1024
metadataobjectNoKling-specific options

metadata Fields

metadata is passed through as Kling request fields. Common fields:

FieldTypeDescription
negative_promptstringNegative prompt
aspect_ratiostringAspect ratio, such as 16:9, 9:16, 1:1
image_tailstringLast-frame image URL
cfg_scalenumberPrompt relevance
camera_controlobjectCamera control
static_maskstringStatic mask
dynamic_masksobject[]Dynamic masks
callback_urlstringCallback URL
external_task_idstringClient-defined task ID

Text to Video

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "kling-v3",
    "prompt": "A cinematic shot of a futuristic cubic city at sunrise, slow camera movement, realistic lighting",
    "mode": "std",
    "duration": 5,
    "size": "1920x1080",
    "metadata": {
      "aspect_ratio": "16:9",
      "negative_prompt": "blur, distortion, low quality"
    }
  }'

Image to Video

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "kling-v3",
    "prompt": "Animate the product from the first frame with a slow clockwise rotation, keep the product shape stable",
    "image": "https://example.com/first-frame.png",
    "mode": "std",
    "duration": 5,
    "metadata": {
      "aspect_ratio": "16:9",
      "negative_prompt": "deformation, flicker"
    }
  }'

First and Last Frame

bash
curl -X POST https://cubicspaces.cloud/v1/video/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "kling-v3",
    "prompt": "Create a smooth transition from the first frame to the last frame",
    "image": "https://example.com/first-frame.png",
    "duration": 5,
    "metadata": {
      "image_tail": "https://example.com/last-frame.png",
      "aspect_ratio": "16:9"
    }
  }'

Camera Control Example

json
{
  "model": "kling-v3",
  "prompt": "A slow push-in shot toward the product on a clean studio table",
  "image": "https://example.com/product.png",
  "duration": 5,
  "metadata": {
    "aspect_ratio": "16:9",
    "camera_control": {
      "type": "simple",
      "config": {
        "zoom": 1.2,
        "horizontal": 0,
        "vertical": 0
      }
    }
  }
}

Kling-Compatible API Examples

Use the compatible paths if you prefer a Kling-like request format.

Text to Video

bash
curl -X POST https://cubicspaces.cloud/kling/v1/videos/text2video \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model_name": "kling-v3",
    "prompt": "A cinematic aerial shot of a futuristic cubic city",
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9",
    "negative_prompt": "blur, distortion"
  }'

Image to Video

bash
curl -X POST https://cubicspaces.cloud/kling/v1/videos/image2video \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model_name": "kling-v3",
    "prompt": "Animate the subject naturally while preserving the first-frame composition",
    "image": "https://example.com/first-frame.png",
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'

Create Response

A successful unified create request returns a video task object:

json
{
  "id": "video_xxx",
  "task_id": "video_xxx",
  "object": "video",
  "model": "kling-v3",
  "status": "queued",
  "progress": 0,
  "created_at": 1770000000
}

Use either id or task_id to retrieve the task.

Retrieve Task

bash
curl https://cubicspaces.cloud/v1/video/generations/video_xxx \
  -H "Authorization: Bearer YOUR_API_KEY"

Retrieve Response

json
{
  "id": "video_xxx",
  "task_id": "video_xxx",
  "object": "video",
  "model": "kling-v3",
  "status": "completed",
  "progress": 100,
  "seconds": "5",
  "created_at": 1770000000,
  "completed_at": 1770000120,
  "metadata": {
    "url": "https://example.com/output.mp4"
  }
}

Status Values

statusDescription
queuedThe task is queued
in_progressThe task is running
completedThe task has completed
failedThe task failed

When the task is completed, read the video URL from metadata.url.