API DocsAI Model APIsVideosKling 2.6

Image-to-Video

Generate video from a first frame or first-and-last frames plus an optional text prompt. Async task API: submit, poll, then download.

  • First frame: one first-frame image + optional text
  • First & last frames: first-frame image + last-frame image + optional text

Supports native audio and designated voices. Duration: 5 or 10 seconds.

This is an async task-based API: submit a request to receive a task id, poll for status, then download the video when complete.

Only Kling 2.6 is supported.

Note: First-frame and first-and-last-frame modes are supported. Last-frame-only generation is not supported.

Base URL

  • https://api.autorouter.top — Production

Authentication

BearerAuth: http (bearer) Authenticate using a Bearer Token. Format: Authorization: Bearer sk-xxxxxx

Endpoints

POST /kling/image-to-video/kling-2.6

Create Video Generation Task

Create a video generation task from a first frame or first-and-last frames.

Request Body

Content-Type: application/json

Example (first frame + voice):

{
  "contents": [
    {
      "type": "prompt",
      "text": "A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train, @1 whispers softly."
    },
    {
      "type": "first_frame",
      "url": "https://example.com/first.png"
    },
    {
      "type": "voice",
      "voice_id": "891495440020668439",
      "id": "1"
    }
  ],
  "settings": {
    "audio": "native",
    "resolution": "1080p",
    "duration": 5
  },
  "options": {
    "callback_url": "https://xxx/callback",
    "external_task_id": "",
    "watermark_info": {
      "enabled": true
    }
  }
}

Example (first & last frames):

{
  "contents": [
    {
      "type": "prompt",
      "text": "Slowly pull the camera back from a close-up"
    },
    {
      "type": "first_frame",
      "url": "https://example.com/first.png"
    },
    {
      "type": "last_frame",
      "url": "https://example.com/last.png"
    }
  ],
  "settings": {
    "resolution": "720p",
    "duration": 5
  }
}

Properties:

NameTypeRequiredDescription
contentsobject[]YesReference inputs (prompts, images, voices, etc.)
contents[].typestringYesInput type: prompt, first_frame, last_frame, voice
settingsobjectNoOutput config such as resolution and duration
settings.audiostringNoWhether to generate audio. native or off; default off
settings.resolutionstringNoVideo resolution. 720p or 1080p; default 720p
settings.durationintegerNoDuration in seconds. 5 or 10; default 5
optionsobjectNoGeneral config such as callback URL and watermark
options.callback_urlstringNoCallback URL for task status changes
options.external_task_idstringNoCustom task ID; must be unique within the account
options.watermark_infoobjectNoWhether to also generate a watermarked result

contentsobject[](Required)

Reference input collection. Example format:

[
  {
    "type": "prompt",
    "text": "string"
  },
  {
    "type": "first_frame",
    "url": "string"
  },
  {
    "type": "last_frame",
    "url": "string"
  },
  {
    "type": "voice",
    "voice_id": "string",
    "id": "string"
  }
]

typestring(Required)

Input type:

  • prompt: Text prompt
  • first_frame: First-frame image
  • last_frame: Last-frame image
  • voice: Voice
type=promptobject(Mode-dependent)
{
  "type": "prompt",
  "text": "string"
}
  • text: Prompt content, max 2500 characters
  • Reference a voice in the prompt with @xxx, e.g. @1 or @sweet
type=first_frame / last_frameobject(Mode-dependent)
{
  "type": "first_frame",
  "url": "string"
}
  • first_frame is required; last_frame is optional
  • url: Image URL or Base64
  • Formats: .jpg, .jpeg, .png
  • Size: max 50MB
  • Dimensions: width and height ≥ 300px; aspect ratio between 1:2.5 and 2.5:1
  • Supports first-frame and first-and-last-frame generation; last-frame-only is not supported
  • When using first and last frames, only 720p resolution is supported
type=voiceobject(Optional)
{
  "type": "voice",
  "voice_id": "string",
  "id": "string"
}
  • voice_id: Voice ID from the custom voice API or a system preset
  • id: Input index ID used in the prompt (e.g. @1); must be unique within the same task
  • At most 2 voices per task
  • When specifying a voice, settings.audio cannot be off

settingsobject(Optional)

Output configuration such as resolution and duration.

audiostring(Optional)

Whether to generate audio for the video. Default off.

  • native: Include native audio matching the visuals; only 1080p is supported
  • off: No audio; designated voice is not supported in this mode
resolutionstring(Optional)

Output video resolution. Default 720p.

  • 720p: 720P output
  • 1080p: 1080P output

Notes:

  • With native audio, only 1080p is supported
  • With first and last frames, only 720p is supported
durationinteger(Optional)

Video duration in seconds. Default 5.

Options: 5, 10

optionsobject(Optional)

General configurations such as callback URL and watermark.

{
  "callback_url": "https://example.com/cb",
  "external_task_id": "string",
  "watermark_info": {
    "enabled": false
  }
}

callback_urlstring(Optional)

Callback URL for task result notifications. If set, the server sends a notification when the task status changes.

external_task_idstring(Optional)

Custom task ID. Does not overwrite the system-generated task ID and can be used for querying. Must be unique within the account.

watermark_infoobject(Optional)

Whether to also generate a watermarked result, controlled by enabled:

{
  "enabled": false
}
  • true: Include watermarked result
  • false (default): No watermark

Custom watermarks are not supported.

Responses

200: Task created successfully

Content-Type: application/json

Request Example

curl -X POST "https://api.autorouter.top/kling/image-to-video/kling-2.6" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxxxx" \
  -d '{
  "contents": [
    {
      "type": "prompt",
      "text": "A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train."
    },
    {
      "type": "first_frame",
      "url": "https://example.com/first.png"
    }
  ],
  "settings": {
    "resolution": "1080p",
    "duration": 5
  }
}'

Response Example

{
  "code": 0,
  "message": "string",
  "request_id": "string",
  "data": {
    "id": "string",
    "status": "submitted",
    "create_time": 1781080778802,
    "update_time": 1781080794151,
    "external_id": "string"
  }
}

Response fields:

NameTypeDescription
codeintegerError code; 0 means success
messagestringError message
request_idstringRequest ID generated by the system
data.idstringSystem-generated task ID
data.statusstringTask status: submitted, processing, succeeded, failed
data.create_timeintegerTask creation time, Unix timestamp (ms)
data.update_timeintegerTask update time, Unix timestamp (ms)
data.external_idstringCustom task ID, if any

GET /kling/tasks

Query Video Generation Task

Query async task status and results by task ID or custom task ID.

  • Use either task_ids or external_task_ids, not both
  • Batch queries are supported; separate multiple IDs with ,
  • Generated results are cleared after about 30 days; save them promptly

Query Params

NameTypeRequiredDescription
task_idsstringNoSystem-generated task IDs, comma-separated
external_task_idsstringNoCustom task IDs, comma-separated

Responses

200: Task queried successfully

Content-Type: application/json

Request Example

curl -X GET "https://api.autorouter.top/kling/tasks?task_ids={id}" \
  -H "Authorization: Bearer sk-xxxxxx"

Response Example

{
  "code": 0,
  "message": "string",
  "request_id": "string",
  "data": [
    {
      "id": "893605946402811985",
      "status": "succeeded",
      "message": "string",
      "create_time": 1781080778802,
      "update_time": 1781080794151,
      "external_id": "string",
      "outputs": [
        {
          "type": "video",
          "id": "string",
          "url": "string",
          "watermark_url": "string",
          "duration": "string"
        },
        {
          "type": "image",
          "url": "string",
          "watermark_url": "string",
          "group_id": "string"
        },
        {
          "type": "audio",
          "id": "string",
          "mp3_url": "string",
          "wav_url": "string",
          "mp3_duration": "string",
          "wav_duration": "string"
        },
        {
          "type": "voice",
          "id": "string",
          "name": "string",
          "url": "string",
          "owned_by": "string",
          "status": "succeeded"
        },
        {
          "type": "element",
          "id": "string",
          "name": "string",
          "description": "string",
          "element_type": "string",
          "references": [
            {
              "type": "image",
              "role": "string",
              "url": "string"
            },
            {
              "type": "video",
              "role": "refer",
              "url": "string"
            },
            {
              "type": "voice",
              "role": "refer",
              "url": "string",
              "id": "string",
              "name": "string",
              "owned_by": "string"
            }
          ],
          "owned_by": "string",
          "status": "string",
          "tags": [
            {
              "id": 1,
              "name": "string",
              "description": "string"
            }
          ]
        }
      ],
      "billing": [
        {
          "charge_type": "string",
          "cash_type": "string",
          "amount": "string",
          "package_type": "string",
          "list_price": "string"
        }
      ]
    }
  ]
}

Response fields:

NameTypeDescription
codeintegerError code; 0 means success
messagestringError message
request_idstringRequest ID generated by the system, for tracing and troubleshooting
dataobject[]Task list
data[].idstringTask ID being queried
data[].statusstringTask status: submitted, processing, succeeded, failed
data[].messagestringStatus message; failure reason when failed (e.g. content moderation)
data[].create_timeintegerTask creation time, Unix timestamp (ms)
data[].update_timeintegerTask update time, Unix timestamp (ms)
data[].external_idstringCustom task ID, if any
data[].outputsobject[]Generated results; fields vary by type
data[].billingobject[]Billing details

statusstring

Task status:

  • submitted: Submitted
  • processing: Processing
  • succeeded: Succeeded
  • failed: Failed

Recommended poll interval: 3–5 seconds until status is succeeded or failed.

outputsobject[]

Generated results. Fields depend on type. Possible values: image, video, audio, element, voice. Image-to-video success typically returns type=video.

type=videoobject
NameTypeDescription
typestringFixed as video
idstringVideo ID generated by the system
urlstringResult URL (hotlink-protected; cleared after ~30 days; save promptly)
watermark_urlstringWatermarked result URL (hotlink-protected)
durationstringGenerated video duration in seconds
type=imageobject
NameTypeDescription
typestringFixed as image
urlstringResult URL (hotlink-protected; cleared after ~30 days)
watermark_urlstringWatermarked image download URL (hotlink-protected)
group_idstringOnly present for grouped images; marks group relationship
type=audioobject
NameTypeDescription
typestringFixed as audio
idstringAudio ID generated by the system
mp3_urlstringMP3 result URL (hotlink-protected; cleared after ~30 days)
wav_urlstringWAV result URL (hotlink-protected; cleared after ~30 days)
mp3_durationstringMP3 duration in seconds
wav_durationstringWAV duration in seconds
type=voiceobject
NameTypeDescription
typestringFixed as voice
idstringAudio ID generated by the system
namestringAudio name
urlstringMaterial download link
owned_bystringVoice source: kling for official library, numbers for creator ID
statusstringStatus: succeeded, deleted
type=elementobject
NameTypeDescription
typestringFixed as element
idstringElement ID generated by the system
namestringElement name
descriptionstringElement description
element_typestringElement type: video_character_elements, multi_image_elements
referencesobject[]Related materials
references[].typestringMaterial type: image, video, voice
references[].rolestringMaterial role; image: frontal / reference; video and voice: refer
references[].urlstringMaterial download link
references[].idstringVoice ID (when type=voice)
references[].namestringVoice name (when type=voice)
references[].owned_bystringVoice source (when type=voice)
owned_bystringElement source: kling for official library, numbers for creator ID
statusstringStatus: succeeded, deleted
tagsobject[]Element tags
tags[].idintegerTag ID
tags[].namestringTag name
tags[].descriptionstringTag description

billingobject[]

Billing details.

charge_typestring

Account charge type:

  • cash: Balance deduction
  • unit: Resource package deduction
cash_typestring

Balance type; only present when charge_type=cash:

  • balance: Official quota
  • test_balance: Test quota
amountstring

Deduction amount. When charge_type=cash, the discounted balance price; when charge_type=unit, the resource package units deducted (decimal string).

package_typestring

Resource package type; only present when charge_type=unit. Enum: video, image, audio.

list_pricestring

List price for balance deduction; only present when charge_type=cash.

Error Handling

HTTP 400 Parameter Errors

ScenarioSuggestion
Missing first-frame imageProvide at least one type=first_frame
Last frame onlyNot supported; include a first frame
First & last frames with non-720pSet settings.resolution to 720p
Designated voice with audio=offSet settings.audio to native
Native audio with non-1080pSet settings.resolution to 1080p
Invalid image format / sizeFollow first_frame / last_frame limits

HTTP 401 / 403 Auth Errors

  • 401 Unauthorized: Invalid or expired API Key
  • 403 Forbidden: API Key is not allowed to access this model

HTTP 402 Insufficient Balance

Insufficient balance. Please top up in the AutoRouter console.

Task failed Status

CauseSuggestion
Content moderation failedAdjust the prompt or change the reference image
Image URL unreachableEnsure public access, or use Base64
Invalid parameter combinationFollow the Request Body rules

When a task fails, AutoRouter automatically refunds your account.

On this page