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-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