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": "参考動画に合わせてキャラクターが振り向いて手を振る動作を行う、映画的な照明",
"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": "参考動画に合わせてキャラクターが振り向いてhand を振る動作を行う、映画的な照明",
"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: "参考動画に合わせてキャラクターが振り向いて手を振る動作を行う、映画的な照明",
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": "リクエストパラメータが無効です",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "認証に失敗しました。APIキーをご確認ください。",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "残高不足です。チャージしてから再試行してください。",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "リクエストが多すぎます。しばらくしてから再試行してください。",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "サーバー内部エラーが発生しました。しばらくしてから再試行してください。",
"type": "server_error"
}
}
Kling 2.6
Kling v2.6 Motion Control 動画生成
- Kling モーションコントロールモデル(参考画像 + 参考動画)
- 統一エンドポイント
/v1/videos/generations経由で呼び出し - image / video の 2 種類のキャラクター方向をサポート、最大時間はそれぞれ 10s / 30s
- 非同期タスク — 送信後に 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": "参考動画に合わせてキャラクターが振り向いて手を振る動作を行う、映画的な照明",
"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": "参考動画に合わせてキャラクターが振り向いてhand を振る動作を行う、映画的な照明",
"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: "参考動画に合わせてキャラクターが振り向いて手を振る動作を行う、映画的な照明",
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": "リクエストパラメータが無効です",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "認証に失敗しました。APIキーをご確認ください。",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "残高不足です。チャージしてから再試行してください。",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "リクエストが多すぎます。しばらくしてから再試行してください。",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "サーバー内部エラーが発生しました。しばらくしてから再試行してください。",
"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": "参考動画に合わせてキャラクターが振り向いて手を振る動作を行う、映画的な照明",
"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": "参考動画に合わせてキャラクターが振り向いてhand を振る動作を行う、映画的な照明",
"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: "参考動画に合わせてキャラクターが振り向いて手を振る動作を行う、映画的な照明",
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": "リクエストパラメータが無効です",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "認証に失敗しました。APIキーをご確認ください。",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "残高不足です。チャージしてから再試行してください。",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "リクエストが多すぎます。しばらくしてから再試行してください。",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "サーバー内部エラーが発生しました。しばらくしてから再試行してください。",
"type": "server_error"
}
}
認証
string
必須
すべてのリクエストに Bearer Token 認証が必要ですAPI Key の取得:API Key 管理ページ にアクセスして API Key を取得してください各リクエストに以下のヘッダーを追加してください:
Authorization: Bearer YOUR_API_KEY
リクエストパラメータ
string
必須
モデル名:
kling-v3-motion-control または kling-v2-6-motion-controlstring
動作・カメラ・スタイルを補足するテキストプロンプト省略可能ですが、具体的に記述するほど安定した結果が得られます例:
"キャラクターが参考動画に合わせて踊る、滑らかな動き、リアルなスタイル"string
必須
参考画像 URL公開アクセス可能なリンクを指定してください
string
必須
参考動画 URL公開アクセス可能な直リンクを指定してください。mp4/mov 推奨、100MB 以内
サーバーが
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
使用例
例 1:image 方向(10 秒以内)
{
"model": "kling-v2-6-motion-control",
"prompt": "参考画像のキャラクターの向きに合わせて振り向いて手を振る",
"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:video 方向(30 秒以内)
{
"model": "kling-v2-6-motion-control",
"prompt": "参考動画のキャラクターの向きとリズムに合わせて、滑らかな動きを維持する",
"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}
}
⌘I