Creare un task Kling text-to-video
Genera video da prompt testuali con Kling tramite CometAPI POST /kling/v1/videos/text2video, quindi monitora lo stato del task e recupera i risultati tramite task ID.
Prima richiesta funzionante
- Invia prima un prompt breve
- Inizia con l’esempio
kling-v3, poi scegli un altromodel_namedall’enum OpenAPI quando hai bisogno di un diverso track di modello - Aggiungi
aspect_ratio,duration,modeosoundsolo dopo che il flusso di base funziona - Imposta
callback_urlse vuoi la consegna push invece del solo polling - Usa
sound: offquando vuoi una prima richiesta deterministica senza audio sui modelli che supportano il suono generato
Denominazione dei modelli
Usa i normali model ID dei video Kling su questo endpoint. Mantieni i model ID Omni per Omni Video.Durata e rapporto d’aspetto
size esatto. Il rapporto d’aspetto richiesto controlla la forma del frame in output.
Flusso del task
Invia la richiesta di generazione
Interroga lo stato del task
Salva il risultato
Autorizzazioni
Bearer token authentication. Use your CometAPI key.
Intestazioni
Must be application/json.
Corpo
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