> ## Documentation Index
> Fetch the complete documentation index at: https://wholly.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Kling 2.6

Generate videos from a single input image using the `kling-2.6/image-to-video` model.

## Authentication

All API requests require a Bearer Token.

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

## Create Video Task

Submit an image-to-video generation task using the following endpoint:

```http theme={null}
POST /api/v1/jobs/createTask
```

### Request Body

| Field   | Type   | Required | Description                                     |
| ------- | ------ | -------- | ----------------------------------------------- |
| `model` | string | Yes      | Must be `kling-2.6/image-to-video`.             |
| `input` | object | Yes      | Input parameters for the video generation task. |

<ParamField body="model" type="string" required>
  Must be `grok-imagine/image-to-video`.
</ParamField>

<ParamField body="input" type="object" required>
  Input parameters for the video generation task.

  <ParamField body="image_urls" type="string[]">
    External reference image URLs. Supports JPEG, PNG, and WEBP. Each image can be up to 10 MB. Do not use together with `task_id`.

    Use `@image(n)` in the prompt to reference an uploaded image, for example `@image1 a sunset over the ocean`.

    Only one image is supported at `1080p`. Spicy mode is unavailable when using external images.
  </ParamField>

  <ParamField body="prompt" type="string">
    Optional English-language prompt describing motion, actions, camera work, timing, environment, and motion dynamics. Maximum length: 5000 characters.
  </ParamField>

  <ParamField body="sound" default="false" type="boolean">
    This parameter specifies whether the generated video contains sound (boolean: true/false)
  </ParamField>

  <ParamField body="duration" type="string">
    Generated video duration in seconds. Supported values: `5`, `10`.
  </ParamField>
</ParamField>

## Example Request

```json theme={null}
{
  "model": "kling-2.6/image-to-video",
  "input": {
    "prompt": "In a bright rehearsal room, sunlight streams through the windows, and a standing microphone is placed in the center of the room.",
    "image_urls": [
      "https://demo.com/176485100274.png"
    ],
    "sound": false,
    "duration": "5"
  }
}
```

## Response

### Successful Response

A successful task creation request returns a task ID.

<ResponseField name="code" type="number">
  Response status code.
</ResponseField>

<ResponseField name="msg" type="string">
  Response message. Contains the error description when the request fails.

  **Example:** `success`
</ResponseField>

<ResponseField name="data" type="object" required>
  The task data object containing task id.

  <ResponseField name="taskId" type="string" required>
    The unique identifier for this task.

    **Example:** `task_123456`
  </ResponseField>
</ResponseField>

Use the `taskId` to query the task status and retrieve generation results.

<Card title="Get Task Details" icon="search" href="/get-task-detail">
  Learn how to query task status and obtain generation results.
</Card>

### Error Response

```json theme={null}
{
  "code": 500,
  "msg": "Server Error - An unexpected error occurred while processing the request",
  "data": null
}
```

## Response Codes

| Code  | Status               | Description                                        |
| ----- | -------------------- | -------------------------------------------------- |
| `200` | Success              | Request was processed successfully.                |
| `401` | Unauthorized         | Authentication credentials are missing or invalid. |
| `402` | Insufficient Credits | Account does not have enough credits.              |
| `404` | Not Found            | The requested endpoint does not exist.             |
| `422` | Validation Error     | Request parameters failed validation.              |
| `429` | Rate Limited         | Request limit has been exceeded.                   |
| `433` | Request Limit        | Sub-key usage exceeds the allowed limit.           |
| `455` | Service Unavailable  | The system is undergoing maintenance.              |
| `500` | Server Error         | An unexpected server error occurred.               |
| `501` | Generation Failed    | The content generation task failed.                |
| `505` | Feature Disabled     | The requested feature is currently disabled.       |
