Skip to main content
POST
cURL
Użyj tego endpointu, aby utworzyć zadanie Kling text-to-video na podstawie promptu. Uruchamia ono zadanie asynchroniczne zamiast od razu zwracać gotowy film.

Pierwsze działające żądanie

  • Najpierw wyślij krótki prompt
  • Zacznij od przykładu kling-v3, a następnie wybierz inną wartość model_name z enum w OpenAPI, gdy potrzebujesz innego wariantu modelu
  • Dodaj aspect_ratio, duration, mode lub sound dopiero wtedy, gdy podstawowy przepływ zacznie działać
  • Ustaw callback_url, jeśli chcesz dostarczania push zamiast samego odpytywania
  • Użyj sound: off, gdy chcesz deterministyczne pierwsze żądanie bez audio w modelach, które obsługują generowany dźwięk

Nazewnictwo modeli

Na tym endpointcie używaj zwykłych Kling video model ID. Zachowaj Omni model ID dla Omni Video.

Czas trwania i proporcje obrazu

Ten endpoint nie udostępnia osobnego tokena rozdzielczości ani dokładnego pola size. Żądane proporcje obrazu kontrolują kształt klatki wyjściowej.

Przepływ zadania

1

Prześlij żądanie generowania

Utwórz zadanie przez ten endpoint i zapisz zwrócone Kling task id.
2

Odpytuj stan zadania

Sprawdzaj postęp przez Pobierz zadanie Kling, aż zadanie osiągnie stan końcowy.
3

Zapisz wynik

Gdy Kling zwróci metadane gotowego zasobu, przenieś wynik do własnego storage, jeśli potrzebujesz długiego okresu przechowywania.
Pełną macierz parametrów i szczegóły dotyczące wariantów modeli znajdziesz w oficjalnej dokumentacji Kling.

Autoryzacje

Authorization
string
header
wymagane

Bearer token authentication. Use your CometAPI key.

Nagłówki

Content-Type
string

Must be application/json.

Treść

application/json
prompt
string
wymagane

Text prompt describing the video to generate. Maximum 500 characters.

negative_prompt
string

Elements to exclude from the video. Maximum 200 characters.

aspect_ratio
enum<string>

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.

Dostępne opcje:
16:9,
9:16,
1:1
callback_url
string

Webhook URL to receive task status updates when the task completes.

model_name
enum<string>
domyślnie:kling-v1

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.

Dostępne opcje:
kling-v1,
kling-v1-6,
kling-v2-master,
kling-v2-1-master,
kling-v2-5-turbo,
kling-v2-6,
kling-v3
cfg_scale
number

Prompt adherence strength. Higher values follow the prompt more closely. Range: 0–1.

mode
enum<string>
domyślnie:std

Generation mode. std for standard (faster), pro for professional (higher quality). The default is std.

Dostępne opcje:
std,
pro
duration
string
domyślnie:5

Output video length in seconds. Use 5 or 10; omit to use 5.

camera_control
object

Camera motion preset or manual configuration. Omit for automatic camera movement.

external_task_id
string

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.

sound
enum<string>

Optional generated-audio switch for models that support video sound. Use on or off, or omit the field for the model default.

Dostępne opcje:
on,
off

Odpowiedź

200 - application/json

Successful Response

code
integer

Error code; specifically define the error code

message
string

error message

request_id
string

Request ID, system-generated, for tracking requests, troubleshooting issues

data
object