curl --request POST \
--url 'https://api.elkapi.com/kling/v1/videos/text2video' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
}'
import requests
url = "https://api.elkapi.com/kling/v1/videos/text2video"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/kling/v1/videos/text2video";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"task_id": "task_1234567890",
"status": "queued"
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
Kling 形式
Klingテキスト動画生成
- Klingモデルを使ってテキスト説明から動画を生成します。
- 対応モデル: kling-v1、kling-v1-5 など
POST
/
kling
/
v1
/
videos
/
text2video
curl --request POST \
--url 'https://api.elkapi.com/kling/v1/videos/text2video' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
}'
import requests
url = "https://api.elkapi.com/kling/v1/videos/text2video"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/kling/v1/videos/text2video";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"task_id": "task_1234567890",
"status": "queued"
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
curl --request POST \
--url 'https://api.elkapi.com/kling/v1/videos/text2video' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
}'
import requests
url = "https://api.elkapi.com/kling/v1/videos/text2video"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/kling/v1/videos/text2video";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "kling-v3",
"prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
"image": "https://example.com/image.png",
"duration": 5,
"response_format": "json",
"metadata": {}
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"task_id": "task_1234567890",
"status": "queued"
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
Authorizations
string
必須
すべてのエンドポイントで Bearer Token 認証が必要です。リクエストヘッダーに追加します:
Authorization: Bearer YOUR_API_KEY
Body
string
デフォルト:"kling-v3"
モデル/スタイルID例:
kling-v3string
テキストプロンプト例:
宇宙飛行士が立ち上がって歩き去ったstring
画像入力(URLまたはBase64)例:
https://example.com/image.jpgnumber
動画の長さ(秒)例:
5integer
動画の幅例:
1280integer
動画の高さ例:
720integer
動画フレームレート例:
30integer
ランダムシード例:
20231234integer
生成する動画数例:
1string
レスポンス形式例:
urlstring
ユーザー識別子例:
user-1234object
拡張パラメーター(negative_prompt、style、quality_level など)
Response
string
タスクID例:
abcd1234efghstring
タスク状態例:
queued⌘I