Kling 2.6 图生视频
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/kling26-image-to-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image_urls": [
"https://example.com/input.jpg"
],
"prompt": "The person in the image starts to smile and wave",
"duration": 5,
"sound": false
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/kling26-image-to-video"
payload = {
"image_urls": ["https://example.com/input.jpg"],
"prompt": "The person in the image starts to smile and wave",
"duration": 5,
"sound": False
}
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({
image_urls: ['https://example.com/input.jpg'],
prompt: 'The person in the image starts to smile and wave',
duration: 5,
sound: false
})
};
fetch('https://api.sinancode.com/v1/generate/k/kling26-image-to-video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sinancode.com/v1/generate/k/kling26-image-to-video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_urls' => [
'https://example.com/input.jpg'
],
'prompt' => 'The person in the image starts to smile and wave',
'duration' => 5,
'sound' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sinancode.com/v1/generate/k/kling26-image-to-video"
payload := strings.NewReader("{\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ],\n \"prompt\": \"The person in the image starts to smile and wave\",\n \"duration\": 5,\n \"sound\": false\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))
}HttpResponse<String> response = Unirest.post("https://api.sinancode.com/v1/generate/k/kling26-image-to-video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ],\n \"prompt\": \"The person in the image starts to smile and wave\",\n \"duration\": 5,\n \"sound\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/kling26-image-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ],\n \"prompt\": \"The person in the image starts to smile and wave\",\n \"duration\": 5,\n \"sound\": false\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}视频生成 - Kling 2.6
Kling 2.6 图生视频
使用 Kling 2.6 模型从图片生成视频(异步)
POST
/
generate
/
k
/
kling26-image-to-video
Kling 2.6 图生视频
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/kling26-image-to-video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image_urls": [
"https://example.com/input.jpg"
],
"prompt": "The person in the image starts to smile and wave",
"duration": 5,
"sound": false
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/kling26-image-to-video"
payload = {
"image_urls": ["https://example.com/input.jpg"],
"prompt": "The person in the image starts to smile and wave",
"duration": 5,
"sound": False
}
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({
image_urls: ['https://example.com/input.jpg'],
prompt: 'The person in the image starts to smile and wave',
duration: 5,
sound: false
})
};
fetch('https://api.sinancode.com/v1/generate/k/kling26-image-to-video', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sinancode.com/v1/generate/k/kling26-image-to-video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_urls' => [
'https://example.com/input.jpg'
],
'prompt' => 'The person in the image starts to smile and wave',
'duration' => 5,
'sound' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sinancode.com/v1/generate/k/kling26-image-to-video"
payload := strings.NewReader("{\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ],\n \"prompt\": \"The person in the image starts to smile and wave\",\n \"duration\": 5,\n \"sound\": false\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))
}HttpResponse<String> response = Unirest.post("https://api.sinancode.com/v1/generate/k/kling26-image-to-video")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ],\n \"prompt\": \"The person in the image starts to smile and wave\",\n \"duration\": 5,\n \"sound\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/kling26-image-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ],\n \"prompt\": \"The person in the image starts to smile and wave\",\n \"duration\": 5,\n \"sound\": false\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}使用快手的 Kling 2.6 模型从图片生成视频。
模型特点:
- 图片驱动 - 基于输入图片生成连贯动态视频
- 超长视频 - 支持生成 5 秒或 10 秒高质量视频
- 音频生成 - 可选生成配套音效,增强视频表现力
- 高清画质 - 输出流畅自然的高清视频内容
授权
请使用您的 API Token 进行认证
请求体
application/json
Task parameters
输入图片 URL(必填)
Required array length:
1 element示例:
["https://example.com/input.jpg"]
提示词(必填,最大1000字符)
Required string length:
1 - 1000示例:
"The person in the image starts to smile and wave"
视频时长(可选,5或10秒,默认5)
可用选项:
5, 10 示例:
5
是否包含声音(可选,默认 false)
示例:
false
响应
OK
Task ID
示例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I