Chuyển đến nội dung chính
POST
/
kling
/
v1
/
videos
/
avatar
/
image2video
Create a Kling avatar task
curl --request POST \
  --url https://api.cometapi.com/kling/v1/videos/avatar/image2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "image": "example"
}
'
{
  "code": 123,
  "message": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123,
    "task_info": {}
  }
}
Sử dụng endpoint này để tạo các clip avatar biết nói từ một ảnh nguồn cùng với một nguồn âm thanh.

Trước khi gọi

  • Cung cấp một image avatar dưới dạng URL công khai hoặc chuỗi base64 thô
  • Gửi chính xác một trong hai: audio_id hoặc sound_file
  • Hãy giữ yêu cầu đầu tiên ở mức đơn giản: một ảnh khuôn mặt, một đoạn âm thanh và một prompt ngắn tùy chọn
  • Bắt đầu với mode: std trừ khi bạn thực sự cần chế độ chất lượng cao hơn

Quy tắc nguồn âm thanh

  • audio_id là cách đơn giản nhất khi bạn đã tạo giọng nói thông qua tuyến Kling TTS
  • sound_file phù hợp khi bạn đã có sẵn tệp MP3, WAV, M4A hoặc AAC của riêng mình
  • Âm thanh cho avatar được tài liệu hóa là có độ dài từ 2 đến 60 giây

Quy trình tác vụ

1

Tạo tác vụ avatar

Gửi ảnh và một nguồn âm thanh, sau đó lưu task id được trả về.
2

Thăm dò tác vụ

Tiếp tục với Truy vấn riêng lẻ cho đến khi tác vụ đạt trạng thái kết thúc.
3

Lưu kết quả hoàn tất

Sao chép tài nguyên cuối cùng 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 hơn URL phân phối của nhà cung cấp.
Để xem tài liệu tham chiếu tham số đầy đủ, hãy xem tài liệu Kling Avatar 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

Optional content type header.

Nội dung

application/json
image
string
mặc định:example
bắt buộc

Avatar reference image. Accepts an image URL or raw Base64 string (no data: prefix). Supported formats: JPG, JPEG, PNG. Max file size 10 MB. Minimum dimension 300 px on each side; aspect ratio between 1:2.5 and 2.5:1.

audio_id
string
bắt buộc

Audio ID returned by the Kling TTS API. Only audio clips between 2 and 60 seconds generated within the last 30 days are accepted. Mutually exclusive with sound_file — exactly one must be provided.

sound_file
string

Audio file as a URL or Base64 string. Accepted formats: MP3, WAV, M4A, AAC. Max 5 MB, duration 2–60 seconds. Mutually exclusive with audio_id — exactly one must be provided.

prompt
string

Text prompt to guide avatar actions, emotions, and camera movements. Max 2500 characters.

mode
string

Generation mode. std (standard, faster and more cost-effective) or pro (professional, higher quality output).

callback_url
string

Webhook URL for task status notifications. The server sends a callback when the task status changes.

external_task_id
string

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

Phản hồi

200 - application/json

Task accepted.

code
integer
bắt buộc
message
string
bắt buộc
data
object
bắt buộc