メインコンテンツへスキップ

動画生成

動画生成は非同期です:タスクを送信してタスク ID を取得し、ステータスをポーリングしてから結果をダウンロードします。ゲートウェイは 2 つの形式に対応しています:

形式送信照会備考
OpenAI Sora 形式POST /v1/videosGET /v1/videos/{video_id}標準的な Sora API の形
汎用タスク形式POST /v1/video/generationsGET /v1/video/generations/{task_id}NewAPI 汎用動画タスク

Sora 形式​

タスクの送信​

POST /v1/videos
curl https://test.kailin.com.cn/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "sora-2",
"prompt": "An orange cat rolling in the snow, slow motion",
"seconds": "10",
"size": "1280x720"
}'
パラメーター型必須説明
modelstringはい動画モデル。例:sora-2、sora-2-pro
promptstringはいシーンの説明
secondsstringいいえ長さ(例:"4" / "8" / "12"、モデルに依存)
sizestringいいえ解像度。例:1280x720 / 720x1280
input_referencefileいいえ参照画像/最初のフレーム(multipart のみ)

レスポンス(Video オブジェクト)​

{
"id": "video_abc123",
"object": "video",
"created_at": 1730000000,
"status": "queued",
"model": "sora-2",
"prompt": "An orange cat rolling in the snow, slow motion",
"size": "1280x720",
"seconds": "10",
"progress": 0
}

タスクの照会​

GET /v1/videos/{video_id}
curl https://test.kailin.com.cn/v1/videos/video_abc123 \
-H "Authorization: Bearer sk-your-token"

status は queued → in_progress → completed / failed と遷移し、実行中は progress が 0–100 で進みます。

動画のダウンロード​

GET /v1/videos/{video_id}/content

completed になったら、MP4 のバイナリをダウンロードします:

curl "https://test.kailin.com.cn/v1/videos/video_abc123/content" \
-H "Authorization: Bearer sk-your-token" \
--output result.mp4

汎用タスク形式​

タスクの送信​

POST /v1/video/generations
curl https://test.kailin.com.cn/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "kling-v1",
"prompt": "Shuttles flying over a cyberpunk city",
"duration": 5
}'
パラメーター型必須説明
modelstringはい動画モデル名(モデル一覧を参照)
promptstringはいシーンの説明
image_urlstringいいえ画像→動画用の最初のフレーム画像
duration / size など-いいえその他のパラメーターはモデルごとにパススルー(長さ、解像度、アスペクト比…)

レスポンス​

{ "task_id": "4f6a2b1c-xxxx-xxxx-xxxx" }

タスクの照会​

GET /v1/video/generations/{task_id}
curl https://test.kailin.com.cn/v1/video/generations/4f6a2b1c-xxxx \
-H "Authorization: Bearer sk-your-token"
{
"task_id": "4f6a2b1c-xxxx",
"status": "SUCCESS",
"video_url": "https://oss.example.com/video/xxx.mp4",
"progress": "100%"
}
フィールド説明
statusタスクステータス(SUBMITTED / IN_PROGRESS / SUCCESS / FAILURE、チャネルに依存)
video_url / url結果の URL(フィールド名はチャネルごとに異なります)
progress進捗
注意

動画生成には数十秒から数分かかります。10–30 秒間隔でポーリングし、タスク ID を保存してください(ゲートウェイのタスク記録には保持期間があります)。video_url は一時的なものです — 完了後すぐにファイルを再ホストしてください。