> ## 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.

# Kling 2.6

> Native audio-visual video generation with text-to-video and image-to-video workflows

## 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.

| Capability       | Value                                      |
| ---------------- | ------------------------------------------ |
| Model ID         | `kling-2-6`                                |
| Modes            | `text-to-video`, `image-to-video`          |
| Prompt length    | 1-1000 characters                          |
| Reference images | 1-2 URLs for `image-to-video`              |
| Aspect ratios    | `1:1`, `9:16`, `16:9` for `text-to-video`  |
| Durations        | `5`, `10` seconds                          |
| Audio            | Required `sound` toggle: `true` or `false` |

## Endpoint and authentication

Base URL:

```text theme={null}
https://api.apixo.ai/api/v1
```

| Method | Endpoint                                | Purpose                               |
| ------ | --------------------------------------- | ------------------------------------- |
| `POST` | `/generateTask/kling-2-6`               | Submit a generation task              |
| `GET`  | `/statusTask/kling-2-6?taskId={taskId}` | Poll task status and retrieve results |

All requests require your APIXO API key:

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

Submit requests also require:

```http theme={null}
Content-Type: application/json
```

## Copy-paste async quickstart

This minimal request submits a text-to-video task and returns a `taskId`.

```bash theme={null}
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:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

Save the `taskId`; you need it to poll for the final result.

## Poll for result

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/kling-2-6?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Processing response:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

Success response:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

Failed response:

```json theme={null}
{
  "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`:

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const videoUrls = payload.resultUrls;
```

## Request body

### Text-to-video

```json theme={null}
{
  "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

```json theme={null}
{
  "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

<ParamField body="request_type" type="string" required default="async">
  Result delivery mode. Use `async` for polling with `statusTask`, or `callback` for webhook delivery.
</ParamField>

<ParamField body="callback_url" type="string">
  Required when `request_type` is `callback`. Must be a public HTTPS URL that can receive the final task payload. See [Webhooks](/api-reference/webhooks).
</ParamField>

<ParamField body="input" type="object" required>
  Kling 2.6 input parameters.

  <Expandable title="properties">
    <ParamField body="mode" type="string" required>
      Generation mode. Supported values: `text-to-video`, `image-to-video`.
    </ParamField>

    <ParamField body="prompt" type="string" required>
      Text prompt describing the desired video and optional audio. Supports 1-1000 characters.
    </ParamField>

    <ParamField body="duration" type="integer" required>
      Video duration in seconds. Supported values: `5`, `10`. Numeric strings such as `"5"` and `"10"` are accepted for compatibility.
    </ParamField>

    <ParamField body="sound" type="boolean" required>
      Whether to generate audio. Use `true` for speech, sound effects, ambience, or music; use `false` for silent video.
    </ParamField>

    <ParamField body="aspect_ratio" type="string" default="1:1">
      Output aspect ratio for `text-to-video`. Supported values: `1:1`, `9:16`, `16:9`. This field is not forwarded for `image-to-video`.
    </ParamField>

    <ParamField body="image_urls" type="string[]">
      Reference image URLs. Required for `image-to-video`. Supports 1-2 URLs. The first image is the start/reference frame; the second image can be used as an end frame on routes that support start/end-frame control.
    </ParamField>

    <ParamField body="negative_prompt" type="string">
      Optional negative prompt to reduce unwanted artifacts. Maximum length is 500 characters.
    </ParamField>

    <ParamField body="cfg_scale" type="number">
      Optional guidance scale. Supported range: `0` to `1` in `0.1` increments.
    </ParamField>
  </Expandable>
</ParamField>

## Response format

### Submit task response

`POST /generateTask/kling-2-6` returns a task ID when the task is accepted:

<ResponseField name="code" type="integer">
  API status code. `200` means the task was accepted.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable status message.
</ResponseField>

<ResponseField name="data.taskId" type="string">
  Unique task identifier used with the status endpoint.
</ResponseField>

### Status response fields

<ResponseField name="taskId" type="string">
  Unique task identifier.
</ResponseField>

<ResponseField name="state" type="string">
  Current task state: `pending`, `processing`, `success`, or `failed`.
</ResponseField>

<ResponseField name="resultJson" type="string">
  JSON string containing the generated video URLs. Present when `state` is `success`.
</ResponseField>

<ResponseField name="failCode" type="string">
  Machine-readable failure code. Present when `state` is `failed`.
</ResponseField>

<ResponseField name="failMsg" type="string">
  Human-readable failure message. Present when `state` is `failed`.
</ResponseField>

<ResponseField name="createTime" type="integer">
  Task creation timestamp in Unix milliseconds.
</ResponseField>

<ResponseField name="completeTime" type="integer">
  Task completion timestamp in Unix milliseconds. Present after completion.
</ResponseField>

<ResponseField name="costTime" type="integer">
  Processing duration in milliseconds. Present after successful completion when available.
</ResponseField>

## Webhook callback mode

Use callback mode when your backend should receive the final result automatically instead of polling.

```bash theme={null}
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](/api-reference/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 setting  | Unit price       | Example total             |
| -------------- | ---------------- | ------------------------- |
| `sound: false` | `$0.06 / second` | 5s: `$0.30`; 10s: `$0.60` |
| `sound: true`  | `$0.12 / second` | 5s: `$0.60`; 10s: `$1.20` |

For current route and market comparison pricing, see [Pricing](https://apixo.ai/pricing).

## Latency and polling

Actual latency may vary by prompt complexity, audio requirements, provider route, and current queue load.

| Duration     | Typical generation time | Recommended first poll  | Poll interval |
| ------------ | ----------------------- | ----------------------- | ------------- |
| `5` seconds  | 50s-70s                 | 50s after task creation | 5s-10s        |
| `10` seconds | 80s-100s                | 80s after task creation | 5s-10s        |

<Tip>
  For production workloads, use callback mode to avoid frequent polling while video and audio generation are still running.
</Tip>

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](/api-reference/system).

## Errors and troubleshooting

### HTTP errors

| Code  | Meaning                                                       | What to do                                       |
| ----- | ------------------------------------------------------------- | ------------------------------------------------ |
| `400` | Invalid request body, mode, parameter, prompt, or media URL   | Fix the request before retrying                  |
| `401` | Missing or invalid API key                                    | Check the `Authorization` header                 |
| `402` | Insufficient balance or quota                                 | Add balance or switch account/key                |
| `403` | Key or route cannot access the model, or content was rejected | Check permissions and adjust content             |
| `429` | Rate limit or concurrency limit reached                       | Retry with exponential backoff                   |
| `500` | Server error or upstream provider error                       | Retry with backoff                               |
| `502` | Upstream provider error                                       | Retry with backoff                               |
| `504` | Upstream timeout                                              | Retry or use callback mode for long-running jobs |

### Task failure codes

| Fail code                             | Meaning                                                 | What to do                                        |
| ------------------------------------- | ------------------------------------------------------- | ------------------------------------------------- |
| `SensitiveContentDetected`            | Prompt, input image, or output was flagged as sensitive | Change the prompt or input image                  |
| `InputOutputSensitiveContentDetected` | Input or output failed provider safety checks           | Try different inputs                              |
| `NSFW`                                | NSFW content was detected                               | Use policy-compliant inputs                       |
| `ProhibitedContentDetected`           | Content violates provider policy                        | Adjust the prompt or image                        |
| `PromptLengthExceeded`                | Prompt exceeded the provider limit                      | Shorten the prompt to 1000 characters or fewer    |
| `PromptInvalid`                       | Prompt was invalid or rejected                          | Revise the prompt                                 |
| `ImageFormatIncorrect`                | A reference image could not be processed                | Use a public, direct JPG, PNG, or WebP URL        |
| `Upload error`                        | A media upload failed or exceeded size limits           | Compress or replace the image                     |
| `RateLimited`                         | Provider rate limit was reached                         | Retry later with backoff                          |
| `Timeout`                             | Provider timed out                                      | Retry, simplify the request, or use callback mode |

See [Error Codes](/api-reference/errors) for the full error reference.

## Related links

* [Generation API Overview](/models)
* [Generate Task](/api-reference/generate-task)
* [Status Task](/api-reference/status-task)
* [Webhooks](/api-reference/webhooks)
* [Error Codes](/api-reference/errors)
* [Parameter Specification](/api-reference/parameters)
* [Routing Strategies](/concepts/routing-strategies)
* [Pricing](https://apixo.ai/pricing)
