Kling 4.0 Reference to Video
Tích hợp
kling/v4/reference-to-video
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/kling/v4/reference-to-video?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/kling/v4/reference-to-video?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/kling/v4/reference-to-video", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/vi/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "kling/v4/reference-to-video",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
}
Gọi mô hình Kling 4.0 Reference to Video (kling/v4/reference-to-video) qua Doitong API. Tài liệu cho tác nhân: https://doitong.com/vi/developers/models/kling/v4/reference-to-video.md
POST https://api.doitong.com/v1/run/kling/v4/reference-to-video?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
Nếu trạng thái phản hồi là "queued" hoặc "running", hãy thăm dò GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20 cho đến khi trạng thái là "succeeded"; tệp nằm trong outputs[].url. POST https://api.doitong.com/v1/quote/kling/v4/reference-to-video với cùng nội dung sẽ trả về giá chính xác trước khi chạy.
Các tệp như ví dụ: 1,175 $ 1.175 tín dụng API tệp của bạn được đo trước khi chạy Chạy trên trang này
Khóa API mới của bạn. Khóa này chỉ hiển thị lúc này và đã được chèn vào mã cũng như trường khóa API bên dưới. Hãy giữ bí mật: không bao giờ đưa khóa này vào mã chạy trong trình duyệt.
Được tạo trên Doitong
Các tác phẩm công khai được cộng đồng Doitong tạo bằng Kling 4.0. Tái sử dụng một lời nhắc chỉ với một lần nhấp.
Video
Ultra-realistic cinematic video of a young adult woman walking naturally toward the camera while speaking, with realistic facial expressions and synchronized lip movements, as if she is promoting something to the viewer. She maintains eye contact with the camera, smiles slightly, and uses subtle...
Video
Slow, subtle push-in on the woman's face. The light from the laptop flickers softly across her eyes and cheeks, as if the blurry image on the screen is changing. Her eyes move slightly as she studies the screen, and she takes one slow, tense breath. Behind her, shadows of the snowstorm move...
Video
The enormous ancient dragon descends slowly toward the snowy cliff and lands at the cave mouth. Its huge dark leathery wings beat twice with slow, heavy strokes, sending snow swirling off the cliff in big clouds. Then it folds its wings and settles on the rock, the giant elk still held in its...
Video
**Duration: 5 seconds | Aspect ratio: 16:9 | Children's YouTube Intro | Video with Audio** Animate the provided image into a bright, magical, energetic, professional YouTube intro for a children's entertainment channel, with perfectly synchronized sound effects, cheerful music, and a cute child's...
Video
Authentic 1990s wide-angle film footage. The left man slowly pulls one wooden block from the Jenga tower. As the block comes out, the tower naturally loses balance and realistically collapses onto the table. Frustrated, he angrily sweeps all the fallen wooden blocks off the table with both hands....
Video
Thermal-camera view of a snowy mountain cliff at night in false-color, deep blue and violet cold rock, a huge orange-white heat shape hidden inside a rock crevice, two small bright amber spots glowing like eyes, faint noise grain. Cinematic videorealistic, ultra detailed, 16:9, volumetric light,...
Video
**Duration: 4 seconds | Aspect ratio: 16:9 | Children's YouTube Intro | Video with Audio** Animate the provided image into a bright, magical, energetic, professional YouTube intro for a children's entertainment channel, with perfectly synchronized sound effects, cheerful music, and a cute child's...
Video
**Duration: 4 seconds | Aspect ratio: 16:9 | Children's YouTube Intro | Video with Audio** Animate the provided image into a bright, magical, energetic, professional YouTube intro for a children's entertainment channel, with perfectly synchronized sound effects, cheerful music, and a cute child's...
Video
**Duration: 5 seconds | Aspect ratio: 16:9 | Children's YouTube Intro | Video with Audio** Animate the provided image into a bright, magical, energetic, professional YouTube intro for a children's entertainment channel, with perfectly synchronized sound effects, cheerful music, and a cute child's...
Video
Уютная база отдыха с деревянными домиками-шале среди сосен. Майя и Клиентка заходят в теплое кафе с панорамными окнами. Внутри деревянный интерьер, мягкие диваны и живые цветы. Они садятся за столик, перед ними стоят дымящиеся чашки чая. Мягкий свет ламп создает уют. Средний план, уровень глаз. (...
Video
**Duration: 4 seconds. Aspect ratio: 16:9.** Animate the provided image into a bright, magical, high-energy YouTube intro for a children's entertainment channel. **0–1 second:** The three girls come to life naturally, smiling and blinking. The girl on the left gently swings forward, the girl in...
Video
**Duration: 4 seconds | Aspect ratio: 16:9 | Children's YouTube Intro | Video with Audio** Animate the provided image into a bright, magical, energetic, professional YouTube intro for a children's entertainment channel, with perfectly synchronized sound effects, cheerful music, and a cute child's...
Video
Создай короткий вертикальный юмористический мультфильм для Reels в формате 9:16. Сцена 1: Михаил Шуфутинский стоит в кадре с небольшим настольным календарём или блокнотом. На календаре крупно и хорошо читаемо написано: «2 сентября». Он смотрит на календарь и начинает петь узнаваемую фразу из...
Video
Оживи старую чёрно-белую свадебную фотографию. Молодожёны стоят рядом друг с другом. Жених нежно и с любовью смотрит на невесту, слегка улыбается и бережно касается её руки. Невеста мягко улыбается, немного поворачивает голову к жениху и смотрит на него с теплотой. Их движения естественные,...
Video
The same cute animated toddler is sitting on the soft green grass, crying with big tears after gently falling. Suddenly, his loving mother runs toward him, kneels down and gently picks him up into her arms. She hugs him tightly and comforts him, softly stroking his back. The toddler takes a deep...
Video
С днём рождения, бабушка Люба Хронометраж: ~6 минут Жанр: биографический фильм‑посвящение Музыка: мягкое фортепиано; в сценах про детство и утраты — сдержанная, щемящая мелодия; в сценах про дорогу и работу — ровный, сдержанный ритм; в сценах про кузницу — тёплый, «рукотворный» тембр; в сценах с...
Tạo một yêu cầu
Các điều khiển được tạo từ lược đồ mô hình. Mã và giá sẽ cập nhật khi bạn thay đổi chúng.
/run/kling/v4/reference-to-video?wait=20
báo giá → 1,175 $
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/kling/v4/reference-to-video?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/kling/v4/reference-to-video?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/kling/v4/reference-to-video", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "kling/v4/reference-to-video",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"wait_seconds": 20
}
}
}
Chạy yêu cầu này
Key của bạn vẫn nằm trong trình duyệt này: key chỉ được gửi đến Doitong API và chỉ được lưu trong localStorage nếu bạn chọn Ghi nhớ. Nhận khóa API
Giới thiệu về Kling 4.0 Reference to Video
Tạo video từ `prompt` văn bản cùng hình ảnh tham chiếu, video tham chiếu và elements nhân vật hoặc vật thể, được gọi trong lời nhắc bằng @Image1, @Video1 hoặc @Element1. Thời lượng từ 3 đến 30 giây (mặc định 5), đầu ra ở 720p hoặc 1080p và tỷ lệ khung hình auto, 16:9, 9:16, 1:1 hoặc 21:9. Dùng `multi_prompt` cho lời nhắc từng cảnh; khi đó tổng thời lượng là tổng thời lượng các cảnh. Giới hạn là 10 hình ảnh, 5 video dài 3-30 giây mỗi video và 7 elements, trong đó tối đa 3 elements có thể mang giọng nói.
Tham số
Gửi tên chuẩn hoặc tên gốc, không gửi cả hai. Tên chuẩn
prompttùy chọn
multi_prompttùy chọn
multi_prompt[].promptbắt buộc
multi_prompt[].durationtùy chọn
durationtùy chọn
start_image_urltùy chọn
image
image_urlstùy chọn
images
video_urlstùy chọn
videos
elementstùy chọn
elements[].frontal_image_urltùy chọn
elements[].reference_image_urlstùy chọn
elements[].video_urltùy chọn
elements[].voice_idtùy chọn
resolutiontùy chọn
aspect_ratiotùy chọn
Các tham số tệp nhận URL https:// công khai, URI data: tối đa 10 MB hoặc file_url của một tệp tải lên. Tệp
Đầu ra
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "kling/v4/reference-to-video",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 1175,
"usd": "1.175",
"charged": 1175,
"refunded": 0
},
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"output": {
"video": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp4",
"content_type": "video/mp4",
"file_name": "0-output.mp4",
"file_size": 1843200
}
},
"outputs": [
{
"type": "video",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp4",
"content_type": "video/mp4",
"file_size": 1843200,
"width": 1280,
"height": 720,
"duration": 5,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
Các trường đầu ra
- video
- object {url, content_type, file_name, file_size}Video do mô hình tạo ra.
Các biến thể Kling 4.0 khác
Thêm mô hình: Tham chiếu sang video
Dành cho tác nhân AI: trang này ở dạng Markdown tại https://doitong.com/vi/developers/models/kling/v4/reference-to-video.md. Tất cả mô hình và hướng dẫn: https://doitong.com/developers/llms.txt