Saltar para o conteúdo principal
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"
  }
}

Autenticação

Authorization
string
obrigatório
Todas as requisições exigem autenticação via Bearer TokenObtenha sua chave de API:Acesse a página de gerenciamento de chaves de API para obter sua chave de APIAdicione o seguinte cabeçalho em cada requisição:
Authorization: Bearer YOUR_API_KEY

Parâmetros da requisição

model
string
obrigatório
Nome do modelo: kling-v3-motion-control ou kling-v2-6-motion-control
prompt
string
Prompt de texto descrevendo o movimento desejado, os movimentos de câmera e o estiloOpcional, mas recomendado — descrições mais específicas produzem resultados mais estáveisExemplo: "The character dances following the reference video, smooth motion, realistic style"
image_url
string
obrigatório
URL da imagem de referênciaDeve ser um link publicamente acessível
video_url
string
obrigatório
URL do vídeo de referênciaDeve ser um link direto e publicamente acessível; recomendado mp4/mov, abaixo de 100MB
O servidor analisa a duração real de video_url. O mínimo é 3 segundos; o máximo é determinado por character_orientation.
keep_original_sound
string
padrão:"yes"
Define se a trilha de áudio original do vídeo de referência deve ser mantidaOpções:
  • yes: Manter o áudio original (padrão)
  • no: Não manter o áudio original
character_orientation
string
obrigatório
Controle de orientação do personagemOpções:
  • image: Usa a orientação do personagem da imagem de referência (duração do vídeo de referência: 3~10s)
  • video: Usa a orientação do personagem do vídeo de referência (duração do vídeo de referência: 3~30s)
mode
string
obrigatório
Modo de geraçãoOpções:
  • std: Modo padrão (equilíbrio entre velocidade e qualidade)
  • pro: Modo de alta qualidade (latência maior)
watermark_info
object
Objeto de controle de marca d’água (opcional)

Regras de duração

CondiçãoDuração permitida do vídeo de referência
character_orientation = image3s ~ 10s
character_orientation = video3s ~ 30s
A duração para cobrança é determinada pela duração real analisada pelo servidor a partir de video_url, e não por uma estimativa do lado do cliente.

Resposta

code
integer
Código de status da resposta, 200 em caso de sucesso
data
array
Array de dados da resposta

Exemplos

Exemplo 1: orientação por imagem (até 10s)

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

Exemplo 2: orientação por vídeo (até 30s)

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