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"
}
}
Kling 2.6
Генерация видео Kling v2.6 с управлением движением
- Модель Kling с управлением движением (референсное изображение + референсное видео)
- Вызов через единый эндпоинт
/v1/videos/generations - Поддерживает ориентацию персонажа по изображению / видео, максимальная длительность 10 с / 30 с соответственно
- Асинхронная задача — при отправке возвращается task_id
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"
}
}
Аутентификация
string
обязательно
Все запросы требуют аутентификации по Bearer TokenПолучение API-ключа:Перейдите на страницу управления API-ключами, чтобы получить свой API-ключДобавьте следующий заголовок в каждый запрос:
Authorization: Bearer YOUR_API_KEY
Параметры запроса
string
обязательно
Название модели:
kling-v3-motion-control или kling-v2-6-motion-controlboolean
по умолчанию:"false"
Выполнять ли проверку содержимого перед отправкой задачи генерации видео.
true: проверить промпты и входные изображения с помощьюomni-moderation-latestfalseили параметр не указан: не отправлять запрос на проверку, без дополнительных затрат и задержки (по умолчанию)
string
Текстовое описание желаемого движения, перемещения камеры и стиляНеобязательный, но рекомендуемый параметр — более конкретные описания дают более стабильные результатыПример:
"The character dances following the reference video, smooth motion, realistic style"string
обязательно
URL референсного изображенияДолжен быть публично доступной ссылкой
string
обязательно
URL референсного видеоДолжен быть публично доступной прямой ссылкой; рекомендуется mp4/mov, размер до 100 МБ
Сервер определяет фактическую длительность по
video_url. Минимум — 3 секунды; максимум зависит от значения character_orientation.string
по умолчанию:"yes"
Сохранять ли оригинальную аудиодорожку из референсного видеоВарианты:
yes: сохранять оригинальное аудио (по умолчанию)no: не сохранять оригинальное аудио
string
обязательно
Управление ориентацией персонажаВарианты:
image: использовать ориентацию персонажа из референсного изображения (длительность референсного видео:3~10s)video: использовать ориентацию персонажа из референсного видео (длительность референсного видео:3~30s)
string
обязательно
Режим генерацииВарианты:
std: стандартный режим (баланс скорости и качества)pro: режим высокого качества (более высокая задержка)
object
Объект управления водяным знаком (необязательно)
Показать Поля watermark_info
Показать Поля watermark_info
boolean
по умолчанию:"false"
Добавлять ли водяной знак
true: добавлять водяной знакfalse: без водяного знака (по умолчанию)
Правила длительности
| Условие | Допустимая длительность референсного видео |
|---|---|
character_orientation = image | 3s ~ 10s |
character_orientation = video | 3s ~ 30s |
Длительность для тарификации определяется фактической длительностью, считываемой сервером из
video_url, а не клиентской оценкой.Ответ
integer
Код состояния ответа, 200 при успехе
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}
}