Kling 图生视频
curl --request POST \
--url https://kaienapi.com/kling/v1/videos/image2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-v2-master",
"prompt": "让角色缓慢转身并看向镜头",
"image": "https://example.com/character.png",
"duration": 5,
"mode": "pro"
}
'import requests
url = "https://kaienapi.com/kling/v1/videos/image2video"
payload = {
"model": "kling-v2-master",
"prompt": "让角色缓慢转身并看向镜头",
"image": "https://example.com/character.png",
"duration": 5,
"mode": "pro"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-v2-master',
prompt: '让角色缓慢转身并看向镜头',
image: 'https://example.com/character.png',
duration: 5,
mode: 'pro'
})
};
fetch('https://kaienapi.com/kling/v1/videos/image2video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/kling/v1/videos/image2video"
payload := strings.NewReader("{\n \"model\": \"kling-v2-master\",\n \"prompt\": \"让角色缓慢转身并看向镜头\",\n \"image\": \"https://example.com/character.png\",\n \"duration\": 5,\n \"mode\": \"pro\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Kling 图生视频
Kling 图生视频接口,基于参考图生成视频任务。
请求格式
使用 application/json。至少提交 model、prompt 和图片字段。图片通常使用公网 URL;其他输入格式以模型说明为准。
图片要求
参考图需要能访问、主体清晰,并尽量和目标画幅一致。多图或首尾帧支持情况以模型说明为准。
读取结果
创建成功后保存任务 ID,再调用图生视频查询接口获取状态和结果。
POST
/
kling
/
v1
/
videos
/
image2video
Kling 图生视频
curl --request POST \
--url https://kaienapi.com/kling/v1/videos/image2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kling-v2-master",
"prompt": "让角色缓慢转身并看向镜头",
"image": "https://example.com/character.png",
"duration": 5,
"mode": "pro"
}
'import requests
url = "https://kaienapi.com/kling/v1/videos/image2video"
payload = {
"model": "kling-v2-master",
"prompt": "让角色缓慢转身并看向镜头",
"image": "https://example.com/character.png",
"duration": 5,
"mode": "pro"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'kling-v2-master',
prompt: '让角色缓慢转身并看向镜头',
image: 'https://example.com/character.png',
duration: 5,
mode: 'pro'
})
};
fetch('https://kaienapi.com/kling/v1/videos/image2video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/kling/v1/videos/image2video"
payload := strings.NewReader("{\n \"model\": \"kling-v2-master\",\n \"prompt\": \"让角色缓慢转身并看向镜头\",\n \"image\": \"https://example.com/character.png\",\n \"duration\": 5,\n \"mode\": \"pro\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Authorizations
在请求头中传入:Authorization: Bearer sk-...
Body
application/json
The body is of type object.
Response
任务结果
The response is of type object.
⌘I