Перейти к основному содержанию
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"
  }
}

Аутентификация

Authorization
string
обязательно
Все запросы требуют аутентификации по Bearer TokenПолучение API-ключа:Перейдите на страницу управления API-ключами, чтобы получить свой API-ключДобавьте следующий заголовок в каждый запрос:
Authorization: Bearer YOUR_API_KEY

Параметры запроса

model
string
обязательно
Название модели: kling-v3-motion-control или kling-v2-6-motion-control
prompt
string
Текстовое описание желаемого движения, перемещения камеры и стиляНеобязательный, но рекомендуемый параметр — более конкретные описания дают более стабильные результатыПример: "The character dances following the reference video, smooth motion, realistic style"
image_url
string
обязательно
URL референсного изображенияДолжен быть публично доступной ссылкой
video_url
string
обязательно
URL референсного видеоДолжен быть публично доступной прямой ссылкой; рекомендуется mp4/mov, размер до 100 МБ
Сервер определяет фактическую длительность по video_url. Минимум — 3 секунды; максимум зависит от значения character_orientation.
keep_original_sound
string
по умолчанию:"yes"
Сохранять ли оригинальную аудиодорожку из референсного видеоВарианты:
  • yes: сохранять оригинальное аудио (по умолчанию)
  • no: не сохранять оригинальное аудио
character_orientation
string
обязательно
Управление ориентацией персонажаВарианты:
  • image: использовать ориентацию персонажа из референсного изображения (длительность референсного видео: 3~10s)
  • video: использовать ориентацию персонажа из референсного видео (длительность референсного видео: 3~30s)
mode
string
обязательно
Режим генерацииВарианты:
  • std: стандартный режим (баланс скорости и качества)
  • pro: режим высокого качества (более высокая задержка)
watermark_info
object
Объект управления водяным знаком (необязательно)

Правила длительности

УсловиеДопустимая длительность референсного видео
character_orientation = image3s ~ 10s
character_orientation = video3s ~ 30s
Длительность для тарификации определяется фактической длительностью, считываемой сервером из video_url, а не клиентской оценкой.

Ответ

code
integer
Код состояния ответа, 200 при успехе
data
array
Массив данных ответа

Примеры

Пример 1: ориентация по изображению (в пределах 10 с)

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

Пример 2: ориентация по видео (в пределах 30 с)

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