Skip to main content
POST
cURL
Sử dụng endpoint này để tạo một tác vụ Kling text-to-video từ Prompt. Endpoint này khởi chạy một job bất đồng bộ thay vì trả về ngay một video đã hoàn thiện.

Yêu cầu hoạt động đầu tiên

  • Trước tiên hãy gửi một Prompt ngắn
  • Bắt đầu với ví dụ kling-v3, sau đó chọn model_name khác từ enum OpenAPI khi bạn cần một nhánh model khác
  • Chỉ thêm aspect_ratio, duration, mode hoặc sound sau khi luồng cơ bản đã hoạt động
  • Đặt callback_url nếu bạn muốn nhận kết quả theo cơ chế push thay vì chỉ polling
  • Dùng sound: off khi bạn muốn một yêu cầu đầu tiên không có âm thanh và có tính xác định trên các model hỗ trợ tạo âm thanh

Đặt tên model

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

Thời lượng và tỷ lệ khung hình

Endpoint này không cung cấp token độ phân giải riêng hoặc trường size chính xác. Tỷ lệ khung hình được yêu cầu sẽ kiểm soát hình dạng khung hình đầu ra.

Luồng tác vụ

1

Gửi yêu cầu tạo

Tạo tác vụ thông qua endpoint này và lưu Kling task id được trả về.
2

Polling trạng thái tác vụ

Kiểm tra tiến trình thông qua Lấy một tác vụ Kling cho đến khi tác vụ đạt tới trạng thái kết thúc.
3

Lưu trữ kết quả

Khi Kling trả về metadata của asset đã hoàn tất, hãy chuyển kết quả vào hệ thống lưu trữ của riêng bạn nếu bạn cần lưu giữ lâu dài.
Để xem đầy đủ ma trận tham số và chi tiết về các nhánh model, hãy tham khảo 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.

Tiêu đề

Content-Type
string

Must be application/json.

Nội dung

application/json
prompt
string
bắt buộc

Text prompt describing the video to generate. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

aspect_ratio
enum<string>

Aspect ratio request. Typical rendered sizes are 1280x720 for 16:9, 720x1280 for 9:16, and 960x960 for 1:1. This endpoint does not expose an exact size field.

Tùy chọn có sẵn:
16:9,
9:16,
1:1
callback_url
string

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

model_name
enum<string>
mặc định:kling-v1

Model ID for this text-to-video request. Use an ordinary Kling video model ID; use Omni model IDs only with the Omni Video endpoint.

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

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

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

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

Tùy chọn có sẵn:
std,
pro
duration
string
mặc định:5

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

camera_control
object

Camera motion preset or manual configuration. Omit for automatic camera movement.

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

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object