Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Kling 2.6 is Kuaishou’s audio-visual video model for generating short clips with optional speech, sound effects, ambience, and background audio. Use this page when you are ready to call the API after trying the model in the APIXO playground.
CapabilityValue
Model IDkling-2-6
Modestext-to-video, image-to-video
Prompt length1-1000 characters
Reference images1-2 URLs for image-to-video
Aspect ratios1:1, 9:16, 16:9 for text-to-video
Durations5, 10 seconds
AudioRequired sound toggle: true or false

Endpoint and authentication

Base URL:
https://api.apixo.ai/api/v1
MethodEndpointPurpose
POST/generateTask/kling-2-6Submit a generation task
GET/statusTask/kling-2-6?taskId={taskId}Poll task status and retrieve results
All requests require your APIXO API key:
Authorization: Bearer YOUR_API_KEY
Submit requests also require:
Content-Type: application/json

Copy-paste async quickstart

This minimal request submits a text-to-video task and returns a taskId.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-6" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a rainy neon street at night with reflections on the pavement and soft traffic ambience",
      "duration": 5,
      "sound": true,
      "aspect_ratio": "16:9"
    }
  }'
Successful response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
Save the taskId; you need it to poll for the final result.

Poll for result

curl -X GET "https://api.apixo.ai/api/v1/statusTask/kling-2-6?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
Processing response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
Success response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
Failed response:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "SensitiveContentDetected",
    "failMsg": "The input or output was flagged as sensitive. Please try again with different inputs.",
    "createTime": 1767965610929,
    "completeTime": 1767965652317
  }
}
Parse resultJson after state becomes success:
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;

Request body

Text-to-video

{
  "request_type": "async",
  "input": {
    "mode": "text-to-video",
    "prompt": "a calm seaside sunrise with waves, distant birds, and soft narration",
    "duration": 5,
    "sound": true,
    "aspect_ratio": "16:9",
    "negative_prompt": "blur, low quality",
    "cfg_scale": 0.6
  }
}

Image-to-video

{
  "request_type": "async",
  "input": {
    "mode": "image-to-video",
    "prompt": "animate this product photo with a slow camera push and subtle ambient music",
    "duration": 10,
    "sound": true,
    "image_urls": [
      "https://example.com/start.jpg",
      "https://example.com/end.jpg"
    ],
    "negative_prompt": "jitter, distortion",
    "cfg_scale": 0.4
  }
}

Parameters

request_type
string
default:"async"
required
Result delivery mode. Use async for polling with statusTask, or callback for webhook delivery.
callback_url
string
Required when request_type is callback. Must be a public HTTPS URL that can receive the final task payload. See Webhooks.
input
object
required
Kling 2.6 input parameters.

Response format

Submit task response

POST /generateTask/kling-2-6 returns a task ID when the task is accepted:
code
integer
API status code. 200 means the task was accepted.
message
string
Human-readable status message.
data.taskId
string
Unique task identifier used with the status endpoint.

Status response fields

taskId
string
Unique task identifier.
state
string
Current task state: pending, processing, success, or failed.
resultJson
string
JSON string containing the generated video URLs. Present when state is success.
failCode
string
Machine-readable failure code. Present when state is failed.
failMsg
string
Human-readable failure message. Present when state is failed.
createTime
integer
Task creation timestamp in Unix milliseconds.
completeTime
integer
Task completion timestamp in Unix milliseconds. Present after completion.
costTime
integer
Processing duration in milliseconds. Present after successful completion when available.

Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.
curl -X POST "https://api.apixo.ai/api/v1/generateTask/kling-2-6" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "image-to-video",
      "prompt": "animate this mountain view with moving clouds, wind, and distant birds",
      "duration": 5,
      "sound": true,
      "image_urls": [
        "https://example.com/mountain-start.jpg"
      ]
    }
  }'
The callback payload uses the same code, message, and data shape as the status response. See Webhooks for delivery requirements and retry behavior.

Billing

Kling 2.6 is billed per output second. The selected duration and required sound value determine the total cost.
Audio settingUnit priceExample total
sound: false$0.06 / second5s: $0.30; 10s: $0.60
sound: true$0.12 / second5s: $0.60; 10s: $1.20
For current route and market comparison pricing, see Pricing.

Latency and polling

Actual latency may vary by prompt complexity, audio requirements, provider route, and current queue load.
DurationTypical generation timeRecommended first pollPoll interval
5 seconds50s-70s50s after task creation5s-10s
10 seconds80s-100s80s after task creation5s-10s
For production workloads, use callback mode to avoid frequent polling while video and audio generation are still running.
Rate limits and concurrency can vary by account, API key, and route. If you receive 429, slow down requests and retry with backoff. For account-level details, see System APIs.

Errors and troubleshooting

HTTP errors

CodeMeaningWhat to do
400Invalid request body, mode, parameter, prompt, or media URLFix the request before retrying
401Missing or invalid API keyCheck the Authorization header
402Insufficient balance or quotaAdd balance or switch account/key
403Key or route cannot access the model, or content was rejectedCheck permissions and adjust content
429Rate limit or concurrency limit reachedRetry with exponential backoff
500Server error or upstream provider errorRetry with backoff
502Upstream provider errorRetry with backoff
504Upstream timeoutRetry or use callback mode for long-running jobs

Task failure codes

Fail codeMeaningWhat to do
SensitiveContentDetectedPrompt, input image, or output was flagged as sensitiveChange the prompt or input image
InputOutputSensitiveContentDetectedInput or output failed provider safety checksTry different inputs
NSFWNSFW content was detectedUse policy-compliant inputs
ProhibitedContentDetectedContent violates provider policyAdjust the prompt or image
PromptLengthExceededPrompt exceeded the provider limitShorten the prompt to 1000 characters or fewer
PromptInvalidPrompt was invalid or rejectedRevise the prompt
ImageFormatIncorrectA reference image could not be processedUse a public, direct JPG, PNG, or WebP URL
Upload errorA media upload failed or exceeded size limitsCompress or replace the image
RateLimitedProvider rate limit was reachedRetry later with backoff
TimeoutProvider timed outRetry, simplify the request, or use callback mode
See Error Codes for the full error reference.