Tạo một tác vụ Kling text-to-video
Tạo video từ Prompt văn bản với Kling qua CometAPI POST /kling/v1/videos/text2video, sau đó theo dõi trạng thái tác vụ và truy xuất kết quả bằng task ID.
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ọnmodel_namekhác từ enum OpenAPI khi bạn cần một nhánh model khác - Chỉ thêm
aspect_ratio,duration,modehoặcsoundsau khi luồng cơ bản đã hoạt động - Đặt
callback_urlnếu bạn muốn nhận kết quả theo cơ chế push thay vì chỉ polling - Dùng
sound: offkhi 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
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ụ
Gửi yêu cầu tạo
Polling trạng thái tác vụ
Lưu trữ kết quả
Ủy quyền
Bearer token authentication. Use your CometAPI key.
Tiêu đề
Must be application/json.
Nội dung
Text prompt describing the video to generate. Maximum 500 characters.
Elements to exclude from the video. Maximum 200 characters.
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.
16:9, 9:16, 1:1 Webhook URL to receive task status updates when the task completes.
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.
kling-v1, kling-v1-6, kling-v2-master, kling-v2-1-master, kling-v2-5-turbo, kling-v2-6, kling-v3 Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.
Generation mode. std for standard (faster), pro for professional (higher quality). The default is std.
std, pro Output video length in seconds. Use 5 or 10; omit to use 5.
Camera motion preset or manual configuration. Omit for automatic camera movement.
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.
Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.
on, off