Skip to main content
POST
cURL
使用這個端點,透過一張來源圖片加上一個音訊來源來建立會說話的虛擬人像短片。

呼叫前須知

  • 提供一張虛擬人像 image,可使用公開 URL 或原始 base64 字串
  • 使用符合 Kling 像素需求的虛擬人像圖片;過小的縮圖會被生成任務拒絕
  • audio_idsound_file 中只能傳送其中一個
  • 第一個請求請盡量保持簡單:一張臉部圖片、一段音訊片段,以及一個可選的簡短 prompt
  • 當參照的音訊屬於必須關聯的先前任務時,請包含 task_id
  • 除非你明確需要更高品質的路徑,否則請從 mode: std 開始

音訊來源規則

  • 當你已透過 Kling TTS 路徑產生語音時,audio_id 是最簡單的方式
  • 當你已經有自己的 MP3、WAV、M4A 或 AAC 資產時,可使用 sound_file
  • 文件說明虛擬人像音訊長度需為 2 到 60 秒

任務流程

1

建立虛擬人像任務

提交圖片與一個音訊來源,然後儲存回傳的 task id。
2

輪詢任務

持續使用 取得 Kling 任務,直到任務進入最終狀態。
3

儲存完成結果

如果你需要在供應商交付 URL 失效後仍保留結果,請將最終資產複製到你自己的儲存空間中。
如需完整參數參考,請參閱官方 Kling Avatar 文件

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

標頭

Content-Type
string

Optional content type header.

主體

application/json
image
string
必填

Avatar image URL or base64 image string. Use an image that meets Kling pixel requirements; very small thumbnails are rejected.

prompt
string
必填

Prompt describing the desired avatar performance.

audio_id
string
必填

Audio id from a prior Kling audio task.

sound_file
string

Public audio URL when you provide your own audio.

task_id
string

Optional prior task id associated with the referenced audio asset.

mode
enum<string>

Generation mode. Use std or pro; omitted requests use std.

可用選項:
std,
pro

回應

200 - application/json

Task accepted.

code
integer
必填
message
string
必填
data
object
必填