Chuyển đến nội dung chính
POST
cURL
Gửi Prompt đến POST /text-to-video/{model} để tạo tác vụ video. Phản hồi chứa id để bạn truy xuất kết quả.

Chọn mô hình

Đặt ID mô hình trong URL. Không thêm trường model vào body JSON.

Tham số request

kling-4.0 không cung cấp tùy chọn settings.audio. Video của mô hình này có một bản âm thanh; hãy bỏ qua trường này thay vì gửi một giá trị mà mô hình không sử dụng. Request sau tạo một video dài năm giây với kling-3.0-turbo:
Gửi body này đến https://api.cometapi.com/text-to-video/kling-3.0-turbo bằng khóa API CometAPI của bạn. Bảng mã OpenAPI cung cấp các request Shell, Python và JavaScript có cùng body.

Truy xuất video

Phản hồi tạo tác vụ có cấu trúc như sau:
Lưu data.id. Sử dụng Lấy tác vụ Kling với ID đó cho đến khi tác vụ đạt trạng thái kết thúc. Đọc URL video từ mảng outputs của tác vụ.

Ủy quyền

Authorization
string
header
bắt buộc

Authenticate with your CometAPI API key.

Tham số đường dẫn

model
enum<string>
mặc định:kling-3.0-turbo
bắt buộc

Kling model ID. kling-4.0 accepts 3-30 second durations and the 21:9 ratio. kling-3.0 supports 4k resolution. The 2.x models accept 5- or 10-second duration.

Tùy chọn có sẵn:
kling-4.0,
kling-3.0-turbo,
kling-3.0,
kling-2.6,
kling-2.5-turbo

Nội dung

application/json

Text-to-video request fields exposed by the CometAPI route. The model ID is a path parameter, not a body field.

prompt
string
bắt buộc

Text description of the video to generate.

Minimum string length: 1
settings
object

Video generation settings exposed by the CometAPI route. The model ID in the URL determines which values are accepted.

options
object

Optional task fields exposed by the CometAPI route.

Phản hồi

200 - application/json

The task was created. Use data.id to retrieve its status and video output.

code
bắt buộc

Request result code. 0 or success indicates acceptance.

message
string
bắt buộc

Result message.

data
object
bắt buộc

Task identifier and submission status.

msg
string

Additional result message when included in the response.

Lần sửa đổi cuối 13 tháng 11, 2026