Passer au contenu 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"
  }
}

Authentification

Authorization
string
requis
Toutes les requêtes nécessitent une authentification par Bearer TokenObtenir votre clé API :Rendez-vous sur la page de gestion des clés API pour obtenir votre clé APIAjoutez l’en-tête suivant à chaque requête :
Authorization: Bearer YOUR_API_KEY

Paramètres de la requête

model
string
requis
Nom du modèle : kling-v3-motion-control ou kling-v2-6-motion-control
prompt
string
Prompt textuel décrivant le mouvement, les mouvements de caméra et le style souhaitésFacultatif mais recommandé — des descriptions plus précises produisent des résultats plus stablesExemple : "The character dances following the reference video, smooth motion, realistic style"
image_url
string
requis
URL de l’image de référenceDoit être un lien publiquement accessible
video_url
string
requis
URL de la vidéo de référenceDoit être un lien direct publiquement accessible ; mp4/mov recommandé, taille inférieure à 100 Mo
Le serveur détecte la durée réelle de video_url. La durée minimale est de 3 secondes ; la durée maximale dépend de character_orientation.
keep_original_sound
string
défaut:"yes"
Conserver ou non la piste audio originale de la vidéo de référenceOptions :
  • yes : conserver l’audio d’origine (par défaut)
  • no : ne pas conserver l’audio d’origine
character_orientation
string
requis
Contrôle de l’orientation du personnageOptions :
  • image : utiliser l’orientation du personnage de l’image de référence (durée de la vidéo de référence : 3~10s)
  • video : utiliser l’orientation du personnage de la vidéo de référence (durée de la vidéo de référence : 3~30s)
mode
string
requis
Mode de générationOptions :
  • std : mode standard (équilibre vitesse / qualité)
  • pro : mode haute qualité (latence plus élevée)
watermark_info
object
Objet de contrôle du filigrane (optionnel)

Règles de durée

ConditionDurée autorisée de la vidéo de référence
character_orientation = image3s ~ 10s
character_orientation = video3s ~ 30s
La durée facturée correspond à la durée réelle détectée par le serveur depuis video_url, et non à une estimation côté client.

Réponse

code
integer
Code de statut de la réponse, 200 en cas de succès
data
array
Tableau de données de la réponse

Exemples

Exemple 1 : orientation par image (dans la limite de 10 s)

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

Exemple 2 : orientation par vidéo (dans la limite de 30 s)

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