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

# Pembuatan Video Kling v3 Omni

>  - Mode pemrosesan asinkron, mengembalikan ID tugas untuk kueri berikutnya
- Antarmuka terpadu teks-ke-video/gambar-ke-video dengan sintaks referensi gambar
- Mendukung mode standar (720P), mode profesional (1080P), dan mode 4K
- Gambar referensi dalam prompt menggunakan sintaks image_N
- Mendukung pembuatan video dengan audio (saling eksklusif dengan video_list) 

```bash cURL theme={null}
curl --request POST \
  --url https://gccai.heqingsong.uk/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "kling-v3-omni",
    "prompt": "Make the person in <<<image_1>>> wave at the camera",
    "image_urls": ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'
```

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

url = "https://gccai.heqingsong.uk/v1/videos/generations"

payload = {
    "model": "kling-v3-omni",
    "prompt": "Make the person in <<<image_1>>> wave at the camera",
    "image_urls": ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
}

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://gccai.heqingsong.uk/v1/videos/generations";

const payload = {
  model: "kling-v3-omni",
  prompt: "Make the person in <<<image_1>>> wave at the camera",
  image_urls: ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
  mode: "std",
  duration: 5,
  aspect_ratio: "16:9"
};

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));
```

```go Go theme={null}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://gccai.heqingsong.uk/v1/videos/generations"

    payload := map[string]interface{}{
        "model":        "kling-v3-omni",
        "prompt":       "Make the person in <<<image_1>>> wave at the camera",
        "image_urls":   []string{"https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"},
        "mode":         "std",
        "duration":     5,
        "aspect_ratio": "16:9",
    }

    jsonData, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

```java Java theme={null}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class Main {
    public static void main(String[] args) throws Exception {
        String url = "https://gccai.heqingsong.uk/v1/videos/generations";

        String payload = """
        {
          "model": "kling-v3-omni",
          "prompt": "Make the person in <<<image_1>>> wave at the camera",
          "image_urls": ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
          "mode": "std",
          "duration": 5,
          "aspect_ratio": "16:9"
        }
        """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(payload))
            .build();

        HttpResponse<String> response = client.send(request,
            HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

```php PHP theme={null}
<?php

$url = "https://gccai.heqingsong.uk/v1/videos/generations";

$payload = [
    "model" => "kling-v3-omni",
    "prompt" => "Make the person in <<<image_1>>> wave at the camera",
    "image_urls" => ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
    "mode" => "std",
    "duration" => 5,
    "aspect_ratio" => "16:9"
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
```

```ruby Ruby theme={null}
require 'net/http'
require 'json'
require 'uri'

url = URI("https://gccai.heqingsong.uk/v1/videos/generations")

payload = {
  model: "kling-v3-omni",
  prompt: "Make the person in <<<image_1>>> wave at the camera",
  image_urls: ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
  mode: "std",
  duration: 5,
  aspect_ratio: "16:9"
}

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json

response = http.request(request)
puts response.body
```

```swift Swift theme={null}
import Foundation

let url = URL(string: "https://gccai.heqingsong.uk/v1/videos/generations")!

let payload: [String: Any] = [
    "model": "kling-v3-omni",
    "prompt": "Make the person in <<<image_1>>> wave at the camera",
    "image_urls": ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
]

var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let error = error {
        print("Error: \(error)")
        return
    }

    if let data = data, let responseString = String(data: data, encoding: .utf8) {
        print(responseString)
    }
}

task.resume()
```

```csharp C# theme={null}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        var url = "https://gccai.heqingsong.uk/v1/videos/generations";

        var payload = @"{
            ""model"": ""kling-v3-omni"",
            ""prompt"": ""Make the person in <<<image_1>>> wave at the camera"",
            ""image_urls"": [""https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp""],
            ""mode"": ""std"",
            ""duration"": 5,
            ""aspect_ratio"": ""16:9""
        }";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

        var content = new StringContent(payload, Encoding.UTF8, "application/json");
        var response = await client.PostAsync(url, content);
        var result = await response.Content.ReadAsStringAsync();

        Console.WriteLine(result);
    }
}
```

```json 200 theme={null}
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_xxxxxxxxxx"
    }
  ]
}
```

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

```json 401 theme={null}
{
  "error": {
    "code": 401,
    "message": "Invalid authentication credentials",
    "type": "authentication_error"
  }
}
```

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

```json 429 theme={null}
{
  "error": {
    "code": 429,
    "message": "Rate limit exceeded. 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"
  }
}
```

## Otorisasi

**Authorization** `string` *required*

Semua endpoint API memerlukan autentikasi Bearer Token

Dapatkan API Key Anda:

Kunjungi [Halaman Manajemen API Key](https://gccai.heqingsong.uk/keys) untuk mendapatkan API Key Anda

Tambahkan ke header request:

```
Authorization: Bearer YOUR_API_KEY
```

## Parameter Request

**model** `string` *required*

Nama model pembuatan video

Model yang didukung:

* `kling-v3-omni` - Kling v3 Omni (antarmuka terpadu)

**nsfw\_check** `boolean` (default: false)

Menentukan apakah moderasi konten dijalankan sebelum tugas video dikirim.

* `true`: periksa prompt dan gambar input dengan `omni-moderation-latest`
* `false` atau dihilangkan: tidak mengirim permintaan moderasi, tanpa biaya atau latensi moderasi tambahan (default)

**prompt** `string` *required*

Prompt teks positif

Mendukung referensi gambar dari `image_urls` menggunakan sintaks `<<<image_N>>>`, dengan `N` dimulai dari 1.

Contoh: `"Make the person in <<<image_1>>> wave at the camera"`

> [!NOTE]
>
> Jika gambar diberikan tetapi prompt tidak berisi referensi `<<<image_N>>>`, sistem akan otomatis menambahkan `<<<image_1>>>` di awal prompt.

**negative\_prompt** `string`

Prompt negatif digunakan untuk mengecualikan konten yang tidak diinginkan. Panjang maksimum 2500 karakter.

**mode** `string` (default: std)

Mode pembuatan

Opsi:

* `std` - Mode standar (720P)
* `pro` - Mode profesional (1080P)
* `4k` - Mode 4K ultra HD

Default: `std`

**duration** `integer` (default: 5)

Default: `5`
Durasi video (detik)

Rentang: 3-15 (minimum 3 detik, maksimum 15 detik)

**⚠️ Catatan:** Harus berupa angka biasa (misalnya `6`), jangan tambahkan tanda kutip, jika tidak error akan terjadi

**aspect\_ratio** `string` (default: 16:9)

Rasio aspek video

Opsi:

* `16:9` - Lanskap
* `9:16` - Potret
* `1:1` - Persegi

Default: `16:9`

**image\_urls** `array\<url\>`

Array URL gambar untuk referensi gambar

Referensikan gambar yang sesuai dalam prompt menggunakan sintaks `<<<image_N>>>` (N dimulai dari 1)

Contoh: `["https://example.com/photo.jpg"]`

> [!WARNING]
>
> * URL gambar harus dapat diakses publik tanpa proteksi hotlink
> * Dalam mode gambar-ke-video, `aspect_ratio` dapat ditimpa oleh rasio gambar aktual

**image\_with\_roles** `array\<object\>`

Array gambar berbasis peran, direkomendasikan untuk gambar-ke-video.

Format setiap item: `{ "url": "...", "role": "..." }`

* `first_frame`: frame pertama
* `last_frame`: frame terakhir
* `reference`: gambar referensi

> [!WARNING]
>
> `image_urls` dan `image_with_roles` saling eksklusif. Gunakan hanya salah satu.

**video\_list** `array`

Daftar video referensi (berbasis URL), hingga 1 video.

Gunakan `refer_type` untuk membedakan jenis:

* `base`: video yang akan diedit (default)
* `feature`: video referensi fitur

Gunakan `keep_original_sound` untuk mengontrol audio asli:

* `no`: jangan pertahankan (default)
* `yes`: pertahankan suara asli

Format permintaan:

```json theme={null}
"video_list":[
  { "video_url": "video_url", "refer_type": "base", "keep_original_sound": "no" }
]
```

> [!WARNING]
>
> * `video_url` tidak boleh kosong, dan URL video harus dapat diakses
> * Saat `refer_type=base`:
>   * Frame awal/akhir tidak dapat ditentukan
>   * Video referensi harus 3-10 detik
>   * Durasi video yang dibuat mengikuti video yang diunggah
> * Saat `refer_type=feature` dan `video_url` tidak kosong:
>   * `image_urls` hanya dapat berisi gambar frame pertama
> * Persyaratan video: hanya MP4/MOV; durasi minimal 3 detik; resolusi 720px-2160px; frame rate 24-60fps (output 24fps); ukuran tidak lebih dari 200MB

**multi\_shot** `boolean` (default: false)

Apakah mengaktifkan mode multi-shot.

**shot\_type** `string`

Metode pemisahan shot: `customize` / `intelligence`.

Wajib saat `multi_shot=true`.

**multi\_prompt** `array\<object\>`

Daftar multi-shot, setiap item adalah `{ index, prompt, duration }`.

* Minimum 1 shot, maksimum 6 shot
* `duration` setiap shot harus berupa integer dan >= 1
* Jumlah durasi semua shot harus sama dengan `duration` di level atas
* `index` harus dimulai dari 1 dan meningkat berkesinambungan
* Wajib saat `multi_shot=true` dan `shot_type=customize`

Contoh:

```json theme={null}
[
  { "index": 1, "prompt": "a happy dog in running@element_cat", "duration": 3 },
  { "index": 2, "prompt": "a happy dog play with a cat@element_dog", "duration": 3 }
]
```

**element\_list** `array\<object\>`

Daftar subjek referensi, hingga 3 subjek. Mendukung:

* Membuat subjek secara langsung dengan `name`, `description`, `element_input_urls`

Format umum:

```json theme={null}
[
  {
    "name": "element_dog",
    "description": "a golden retriever, fluffy fur, friendly expression",
    "element_input_urls": [
      "https://example.com/image1.png",
      "https://example.com/image2.png"
    ]
  },
  {
    "name": "element_cat",
    "description": "an orange tabby cat, round face, bright eyes",
    "element_input_urls": [
      "https://example.com/image1.png",
      "https://example.com/image2.png"
    ]
  }
]
```

Catatan:

* Untuk pembuatan langsung, `name`, `description`, `element_input_urls` wajib
* `element_input_urls`: 2 hingga 4 gambar per subjek (yang pertama sebagai gambar frontal, lainnya sebagai referensi)
* Gunakan `@name` di `prompt`, misalnya `"@element_dog dan @element_cat are playing on the grass"`

**watermark** `boolean`

Apakah menambahkan watermark

**audio** `boolean` (default: false)

Apakah membuat video dengan audio

> [!WARNING]
>
> Parameter ini saling eksklusif dengan `video_list`.
>
> Saat `video_list` memiliki nilai, parameter `audio` tidak diperlukan.

### Kendala dan Batas Parameter

* `image_urls` dan `image_with_roles` saling eksklusif
* `mode=4k` tersedia untuk `kling-v3-omni`
* Input hanya frame terakhir (`last_frame` tanpa frame pertama) tidak valid
* Frame awal/akhir dan edit video saling eksklusif: saat `video_list.refer_type=base` (atau dihilangkan), frame awal/akhir tidak diizinkan
* Saat `video_list` ada, `audio` diabaikan
* `video_list` mendukung paling banyak 1 video
* `multi_prompt` mendukung hingga 6 shot, dengan `index` dimulai dari 1 dan meningkat berkesinambungan

## Sintaks Referensi Gambar

Model Omni menggunakan sintaks `<<<image_N>>>` untuk merujuk gambar dalam prompt, memberikan pengalaman teks-ke-video/gambar-ke-video yang terpadu:

| Sintaks | Deskripsi |
| - | - |
| `<<<image_1>>>` | Merujuk gambar ke-1 dalam array `image_urls` |
| `<<<image_2>>>` | Merujuk gambar ke-2 dalam array `image_urls` |

> [!NOTE]
>
> **Referensi Otomatis**: Jika `image_urls` disediakan tetapi prompt tidak berisi referensi `<<<image_N>>>`, sistem akan otomatis menambahkan `<<<image_1>>>` di awal prompt.

## Respons

**code** `integer`

Kode status respons, 200 jika berhasil

**data** `array`

Array data respons

**Elemen Array**

**status** `string`

Status tugas, `submitted` saat pertama kali dikirim

**task\_id** `string`

Pengidentifikasi tugas unik untuk mengueri status dan hasil tugas

## Kasus Penggunaan

### Kasus 1: Teks-ke-Video (Mode Standar)

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "A golden retriever running on the beach, sunset, cinematic",
  "mode": "std",
  "duration": 5,
  "aspect_ratio": "16:9"
}
```

### Kasus 2: Referensi Gambar (Satu Gambar)

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "Make the person in <<<image_1>>> wave at the camera",
  "image_urls": ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
  "mode": "pro",
  "duration": 5
}
```

### Kasus 3: Beberapa Referensi Gambar

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "The character in <<<image_1>>> walks toward the scene in <<<image_2>>>",
  "image_urls": [
    "https://example.com/character.jpg",
    "https://example.com/scene.jpg"
  ],
  "mode": "pro",
  "duration": 5
}
```

### Kasus 4: Gambar Diberikan Tanpa Referensi Eksplisit (Ditambahkan Otomatis)

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "The person slowly turns and smiles",
  "image_urls": ["https://upload.gccai.ai/f/models/9998230426123070-e9d6af04-cb5e-4731-8ae7-abf144cb0d29-9998230586368386-29641169-f698-4ab9-9b6d-380899e6521e-9998230593110693-c1741a3a-.webp"],
  "mode": "std",
  "duration": 5
}
```

> Sistem akan otomatis menambahkan `<<<image_1>>>` di awal prompt, setara dengan `"<<<image_1>>>The person slowly turns and smiles"`.

### Kasus 5: Membuat Video dengan Audio

```json theme={null}
{
  "model": "kling-v3-omni",
  "prompt": "A yellow canary singing on a branch",
  "audio": true,
  "mode": "std",
  "duration": 5
}
```

> **Catatan**: `audio` saling eksklusif dengan `video_list`. Saat `video_list` memiliki nilai, parameter `audio` tidak diperlukan.

> [!NOTE]
>
> **Kueri Hasil Tugas**
>
> Pembuatan video adalah tugas asinkron yang mengembalikan `task_id` saat dikirim. Gunakan endpoint [Dapatkan Status Tugas](https://gccai.heqingsong.uk/id/api-reference/tasks/status.md) untuk mengueri progres dan hasil pembuatan.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.