メインコンテンツへスキップ
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": {}
  }
}
このエンドポイントを使用すると、1 枚の元画像と 1 つの音声ソースから、話すアバター動画クリップを作成できます。

呼び出す前に

  • 1 つのアバター image を公開 URL または生の base64 文字列で指定します
  • audio_id または sound_file のいずれか一方のみを送信します
  • 最初のリクエストはシンプルにしてください: 顔画像 1 枚、音声クリップ 1 つ、必要に応じて短いプロンプト(Prompt)
  • 特別に高品質な経路が必要でない限り、mode: std から始めてください

音声ソースのルール

  • audio_id は、すでに Kling の TTS ルートで音声を生成している場合に最も簡単な方法です
  • sound_file は、すでに独自の MP3、WAV、M4A、または AAC アセットを持っている場合に使えます
  • アバター用音声の長さは 2〜60 秒とされています

タスクフロー

1

アバタータスクを作成

画像と 1 つの音声ソースを送信し、返された task id を保存します。
2

タスクをポーリング

タスクが終端状態に到達するまで、個別クエリ を使って確認を続けます。
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
デフォルト:example
必須

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
必須

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.

レスポンス

200 - application/json

Task accepted.

code
integer
必須
message
string
必須
data
object
必須