Chuyển đến nội dung chính
POST
cURL
Sử dụng endpoint này để làm cho một hình ảnh nguồn chuyển động thành video Kling.

Trước khi gọi

  • Cung cấp một URL hình ảnh công khai hoặc một chuỗi hình ảnh base64
  • Sử dụng hình ảnh đáp ứng yêu cầu pixel của Kling; các ảnh thumbnail quá nhỏ sẽ bị tác vụ tạo từ chối
  • Bắt đầu với ví dụ mặc định kling-v2-6, sau đó chọn model_name khác từ enum trong OpenAPI khi bạn cần một nhánh model khác
  • Giữ request đầu tiên ở mức đơn giản: một hình ảnh đầu vào, một prompt, không có khung hình cuối, không có motion mask
  • Sử dụng dynamic_masks dưới dạng một mảng các đối tượng mask-và-quỹ đạo khi bạn cần kiểm soát chuyển động cục bộ
  • Sử dụng sound: off cho request đầu tiên không âm thanh có tính xác định trên các nhánh model hỗ trợ tạo âm thanh

Đặt tên model

Sử dụng các model ID video Kling thông thường trên endpoint này. Giữ Omni model ID cho Omni Video.

Luồng tác vụ

1

Gửi request image-to-video

Tạo tác vụ và lưu task_id của Kling được trả về.
2

Poll tác vụ

Tiếp tục với Lấy một tác vụ Kling để theo dõi trạng thái tác vụ cho đến khi đầu ra sẵn sàng.
3

Lưu kết quả

Lưu trữ asset đã hoàn tất nếu bạn cần giữ lại lâu hơn thời gian tồn tại của URL phân phối từ nhà cung cấp.
Để xem tham chiếu đầy đủ về các tham số, hãy xem tài liệu Kling chính thức.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Nội dung

application/json
image
string
bắt buộc

Source image URL or base64 image string. Use an image that meets Kling pixel requirements; very small thumbnails are rejected. For base64 input, send the encoded image string as the field value.

prompt
string

Text prompt describing the desired motion. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

callback_url
string

Webhook URL to receive task status updates when the task completes.

mode
enum<string>
mặc định:std

Generation mode. std for standard (faster), pro for professional (higher quality).

Tùy chọn có sẵn:
std,
pro
model_name
enum<string>
mặc định:kling-v1

Model ID for this image-to-video request. Use kling-v3 for new requests. Use Omni model IDs only with the Omni Video endpoint.

Tùy chọn có sẵn:
kling-v1,
kling-v1-5,
kling-v1-6,
kling-v2-master,
kling-v2-1,
kling-v2-1-master,
kling-v2-5-turbo,
kling-v2-6,
kling-v3
image_tail
string

Tail-frame reference image as a Base64 string or public URL. Same format requirements as image. Controls the last frame of the generated video.

cfg_scale
number

Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.

duration
string
mặc định:5

Output video length in seconds. Use 5 or 10; omit to use 5.

static_mask
string

Static brush mask image as a Base64 string or public URL. White areas are frozen in place during video generation. Must match the aspect ratio and resolution of the input image.

dynamic_masks
object[]

Optional motion masks. Each entry contains a mask image and an ordered trajectory list.

external_task_id
string

Custom task id for your own tracking. Does not replace the system-generated task id but can be used to query tasks. Must be unique per user.

sound
enum<string>

Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.

Tùy chọn có sẵn:
on,
off

Phản hồi

200 - application/json

Task accepted.

code
integer
bắt buộc

Error code; specifically define the error code

message
string
bắt buộc

error message

data
object
bắt buộc