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

# Pembuatan Video Kontrol Gerak Kling v2.6

>  - Model kontrol gerak Kling (gambar referensi + video referensi)
- Dipanggil melalui endpoint terpadu `/v1/videos/generations`
- Mendukung orientasi karakter gambar/video, durasi maksimum masing-masing 10 dtk / 30 dtk
- Tugas asinkron — mengembalikan task_id saat dikirim 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "kling-v2-6-motion-control",
      "prompt": "Keep the character consistent, perform a turn and wave following the reference video, cinematic lighting",
      "image_url": "https://example.com/ref-image.png",
      "video_url": "https://example.com/ref-video-8s.mp4",
      "keep_original_sound": "yes",
      "character_orientation": "image",
      "mode": "std",
      "watermark_info": {"enabled": false}
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "kling-v2-6-motion-control",
      "prompt": "Keep the character consistent, perform a turn and wave following the reference video, cinematic lighting",
      "image_url": "https://example.com/ref-image.png",
      "video_url": "https://example.com/ref-video-8s.mp4",
      "keep_original_sound": "yes",
      "character_orientation": "image",
      "mode": "std",
      "watermark_info": {"enabled": False}
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "kling-v2-6-motion-control",
    prompt: "Keep the character consistent, perform a turn and wave following the reference video, cinematic lighting",
    image_url: "https://example.com/ref-image.png",
    video_url: "https://example.com/ref-video-8s.mp4",
    keep_original_sound: "yes",
    character_orientation: "image",
    mode: "std",
    watermark_info: { enabled: false }
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed. Please check your API key.",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient account balance. Please top up and try again.",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests. Please try again later.",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error. Please try again later.",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## Autentikasi

<ParamField header="Authorization" type="string" required>
  Semua request memerlukan autentikasi Bearer Token

  Dapatkan API Key Anda:

  Kunjungi [halaman Manajemen API Key](https://apimart.ai/keys) untuk memperoleh API Key Anda

  Tambahkan header berikut ke setiap request:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Parameter Request

<ParamField body="model" type="string" required>
  Nama model: `kling-v3-motion-control` atau `kling-v2-6-motion-control`
</ParamField>

<ParamField body="prompt" type="string">
  Prompt teks yang menjelaskan gerakan, pergerakan kamera, dan gaya yang diinginkan

  Opsional tetapi direkomendasikan — deskripsi yang lebih spesifik menghasilkan hasil yang lebih stabil

  Contoh: `"The character dances following the video referensi, smooth motion, realistic style"`
</ParamField>

<ParamField body="image_url" type="string" required>
  URL gambar referensi

  Harus berupa tautan yang dapat diakses publik
</ParamField>

<ParamField body="video_url" type="string" required>
  URL video referensi

  Harus berupa tautan langsung yang dapat diakses publik; mp4/mov direkomendasikan, di bawah 100MB

  <Warning>
    Server memeriksa durasi aktual `video_url`. Minimum 3 detik; maksimum ditentukan oleh `character_orientation`.
  </Warning>
</ParamField>

<ParamField body="keep_original_sound" type="string" default="yes">
  Apakah mempertahankan trek audio asli dari video referensi

  Opsi:

  * `yes`: Pertahankan audio asli (default)
  * `no`: Jangan pertahankan audio asli
</ParamField>

<ParamField body="character_orientation" type="string" required>
  Kontrol orientasi karakter

  Opsi:

  * `image`: Gunakan orientasi karakter dari gambar referensi (durasi video referensi: `3~10 dtk`)
  * `video`: Gunakan orientasi karakter dari video referensi (durasi video referensi: `3~30 dtk`)
</ParamField>

<ParamField body="mode" type="string" required>
  Mode pembuatan

  Opsi:

  * `std`: Mode standar (kecepatan dan kualitas seimbang)
  * `pro`: Mode kualitas tinggi (latensi lebih tinggi)
</ParamField>

<ParamField body="watermark_info" type="object">
  Objek kontrol watermark (opsional)

  <Expandable title="watermark_info fields">
    <ParamField body="enabled" type="boolean" default="false">
      Apakah menambahkan watermark

      * `true`: Tambahkan watermark
      * `false`: Tanpa watermark (default)
    </ParamField>
  </Expandable>
</ParamField>

## Aturan Durasi

| Kondisi                         | Durasi Video Referensi yang Diizinkan |
| ------------------------------- | ------------------------------------- |
| `character_orientation = image` | `3 dtk ~ 10 dtk`                      |
| `character_orientation = video` | `3 dtk ~ 30 dtk`                      |

<Note>
  Durasi penagihan ditentukan oleh durasi aktual yang dideteksi dari `video_url` oleh server, bukan perkiraan sisi klien.
</Note>

## Respons

<ResponseField name="code" type="integer">
  Kode status respons, 200 jika berhasil
</ResponseField>

<ResponseField name="data" type="array">
  Array data respons

  <Expandable title="Array elements">
    <ResponseField name="status" type="string">
      Status tugas, `submitted` saat pengiriman awal
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Pengidentifikasi tugas unik yang digunakan untuk mengueri status dan hasil tugas
    </ResponseField>
  </Expandable>
</ResponseField>

## Contoh

### Contoh 1: orientasi gambar (dalam 10 dtk)

```json theme={null}
{
  "model": "kling-v2-6-motion-control",
  "prompt": "Keep character orientation consistent with the reference image, perform a turn and wave",
  "image_url": "https://example.com/ref-image.png",
  "video_url": "https://example.com/ref-video-8s.mp4",
  "character_orientation": "image",
  "mode": "std",
  "keep_original_sound": "yes",
  "watermark_info": {"enabled": false}
}
```

### Contoh 2: orientasi video (dalam 30 dtk)

```json theme={null}
{
  "model": "kling-v2-6-motion-control",
  "prompt": "Follow the character orientation and rhythm of the reference video, maintain fluid motion",
  "image_url": "https://example.com/ref-image.png",
  "video_url": "https://example.com/ref-video-12s.mp4",
  "character_orientation": "video",
  "mode": "pro",
  "keep_original_sound": "no",
  "watermark_info": {"enabled": false}
}
```
