Langsung ke konten utama
POST
/
v1
/
videos
/
generations
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}
  }'
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())
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));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
    }
  ]
}
{
  "error": {
    "code": 400,
    "message": "Invalid request parameters",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": 401,
    "message": "Authentication failed. Please check your API key.",
    "type": "authentication_error"
  }
}
{
  "error": {
    "code": 402,
    "message": "Insufficient account balance. Please top up and try again.",
    "type": "payment_required"
  }
}
{
  "error": {
    "code": 429,
    "message": "Too many requests. Please try again later.",
    "type": "rate_limit_error"
  }
}
{
  "error": {
    "code": 500,
    "message": "Internal server error. Please try again later.",
    "type": "server_error"
  }
}
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}
  }'
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())
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));
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01J9HA7JPQ9A0Z6JZ3V8M9W6PZ"
    }
  ]
}
{
  "error": {
    "code": 400,
    "message": "Invalid request parameters",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": 401,
    "message": "Authentication failed. Please check your API key.",
    "type": "authentication_error"
  }
}
{
  "error": {
    "code": 402,
    "message": "Insufficient account balance. Please top up and try again.",
    "type": "payment_required"
  }
}
{
  "error": {
    "code": 429,
    "message": "Too many requests. Please try again later.",
    "type": "rate_limit_error"
  }
}
{
  "error": {
    "code": 500,
    "message": "Internal server error. Please try again later.",
    "type": "server_error"
  }
}

Autentikasi

Authorization
string
wajib
Semua request memerlukan autentikasi Bearer TokenDapatkan API Key Anda:Kunjungi halaman Manajemen API Key untuk memperoleh API Key AndaTambahkan header berikut ke setiap request:
Authorization: Bearer YOUR_API_KEY

Parameter Request

model
string
wajib
Nama model: kling-v3-motion-control atau kling-v2-6-motion-control
prompt
string
Prompt teks yang menjelaskan gerakan, pergerakan kamera, dan gaya yang diinginkanOpsional tetapi direkomendasikan — deskripsi yang lebih spesifik menghasilkan hasil yang lebih stabilContoh: "The character dances following the video referensi, smooth motion, realistic style"
image_url
string
wajib
URL gambar referensiHarus berupa tautan yang dapat diakses publik
video_url
string
wajib
URL video referensiHarus berupa tautan langsung yang dapat diakses publik; mp4/mov direkomendasikan, di bawah 100MB
Server memeriksa durasi aktual video_url. Minimum 3 detik; maksimum ditentukan oleh character_orientation.
keep_original_sound
string
default:"yes"
Apakah mempertahankan trek audio asli dari video referensiOpsi:
  • yes: Pertahankan audio asli (default)
  • no: Jangan pertahankan audio asli
character_orientation
string
wajib
Kontrol orientasi karakterOpsi:
  • 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)
mode
string
wajib
Mode pembuatanOpsi:
  • std: Mode standar (kecepatan dan kualitas seimbang)
  • pro: Mode kualitas tinggi (latensi lebih tinggi)
watermark_info
object
Objek kontrol watermark (opsional)

Aturan Durasi

KondisiDurasi Video Referensi yang Diizinkan
character_orientation = image3 dtk ~ 10 dtk
character_orientation = video3 dtk ~ 30 dtk
Durasi penagihan ditentukan oleh durasi aktual yang dideteksi dari video_url oleh server, bukan perkiraan sisi klien.

Respons

code
integer
Kode status respons, 200 jika berhasil
data
array
Array data respons

Contoh

Contoh 1: orientasi gambar (dalam 10 dtk)

{
  "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)

{
  "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}
}