Vai al contenuto principale
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": {}
  }
}
Usa questo endpoint per creare clip di avatar parlanti a partire da un’immagine sorgente e una sorgente audio.

Prima di chiamarlo

  • Fornisci un image dell’avatar come URL pubblico o stringa base64 raw
  • Invia esattamente uno tra audio_id o sound_file
  • Mantieni semplice la prima richiesta: un’immagine del volto, una clip audio e un breve prompt facoltativo
  • Inizia con mode: std a meno che tu non abbia bisogno specificamente del percorso di qualità superiore

Regole per la sorgente audio

  • audio_id è il percorso più semplice quando hai già generato il parlato tramite il percorso Kling TTS
  • sound_file funziona quando hai già una tua risorsa MP3, WAV, M4A o AAC
  • La documentazione indica che l’audio dell’avatar deve durare da 2 a 60 secondi

Flusso dell’attività

1

Crea l'attività avatar

Invia l’immagine e una sorgente audio, quindi salva l’id dell’attività restituito.
2

Interroga l'attività

Continua con Individual Queries finché l’attività non raggiunge uno stato terminale.
3

Archivia il risultato finale

Copia la risorsa finale nel tuo sistema di archiviazione se hai bisogno di conservarla oltre l’URL di consegna del provider.
Per il riferimento completo dei parametri, consulta la documentazione ufficiale di Kling Avatar.

Autorizzazioni

Authorization
string
header
obbligatorio

Bearer token authentication. Use your CometAPI key.

Intestazioni

Content-Type
string

Optional content type header.

Corpo

application/json
image
string
predefinito:example
obbligatorio

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
obbligatorio

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.

Risposta

200 - application/json

Task accepted.

code
integer
obbligatorio
message
string
obbligatorio
data
object
obbligatorio