Video Generation

Get started

CognitivessAI exposes async video generation models from Kling. All requests use your CognitivessAI API key (ssh-ed25519 ...) as a bearer token. Submit a task to get a task_id, then poll the result endpoint until the video is ready.

Available Models

Kling v3.0 4K Text-to-Videotext → video
Kling v3.0 4K Image-to-Videoimage → video

Pricing is billed per second of generated video (see Models). Submitting a task charges your credit balance based on the requested duration.

Endpoints

  • POST https://api.cognitivess.com/v1/video/kling-text-to-video — submit text-to-video task
  • POST https://api.cognitivess.com/v1/video/kling-image-to-video — submit image-to-video task
  • GET https://api.cognitivess.com/v1/video/tasks/{task_id} — query task result

Kling v3.0 4K Text-to-Video

Request JSON

{
  "sound": false,
  "duration": 5,
  "cfg_scale": 0.5,
  "aspect_ratio": "16:9"
}

Submit task

import requests

API_KEY = "<YOUR_API_KEY>"  # cheia ssh-ed25519 din dashboard
BASE = "https://api.cognitivess.com"

resp = requests.post(
    f"{BASE}/v1/video/kling-text-to-video",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={"sound": False, "duration": 5, "cfg_scale": 0.5, "aspect_ratio": "16:9"},
)
task_id = resp.json()["task_id"]
print("task_id:", task_id)
const API_KEY = "<YOUR_API_KEY>";
const BASE = "https://api.cognitivess.com";

const resp = await fetch(`${BASE}/v1/video/kling-text-to-video`, {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ sound: false, duration: 5, cfg_scale: 0.5, aspect_ratio: "16:9" }),
});
const { task_id } = await resp.json();
console.log("task_id:", task_id);
curl --location --request POST 'https://api.cognitivess.com/v1/video/kling-text-to-video' \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer <YOUR_API_KEY>" \
  --data-raw '{
    "sound": false,
    "duration": 5,
    "cfg_scale": 0.5,
    "aspect_ratio": "16:9"
  }'

Kling v3.0 4K Image-to-Video

Request JSON

{
  "sound": false,
  "duration": 5,
  "cfg_scale": 0.5,
  "image": "<base64 or URL of the source image>"
}

Submit task

import requests

API_KEY = "<YOUR_API_KEY>"
BASE = "https://api.cognitivess.com"

resp = requests.post(
    f"{BASE}/v1/video/kling-image-to-video",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={"sound": False, "duration": 5, "cfg_scale": 0.5, "image": "<IMAGE>"},
)
task_id = resp.json()["task_id"]
print("task_id:", task_id)
const resp = await fetch(`https://api.cognitivess.com/v1/video/kling-image-to-video`, {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ sound: false, duration: 5, cfg_scale: 0.5, image: "<IMAGE>" }),
});
const { task_id } = await resp.json();
curl --location --request POST 'https://api.cognitivess.com/v1/video/kling-image-to-video' \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer <YOUR_API_KEY>" \
  --data-raw '{
    "sound": false,
    "duration": 5,
    "cfg_scale": 0.5,
    "image": "<IMAGE>"
  }'

Query task result

Once you have a task_id, poll the result endpoint until the task completes.

import time, requests

result = requests.get(
    f"{BASE}/v1/video/tasks/{task_id}",
    headers={"Authorization": f"Bearer {API_KEY}"},
).json()
print(result)
const result = await ( await fetch(`https://api.cognitivess.com/v1/video/tasks/${task_id}`, {
  headers: { Authorization: `Bearer ${API_KEY}` },
})).json();
console.log(result);
curl --location --request GET "https://api.cognitivess.com/v1/video/tasks/${TASK_ID}" \
  --header "Authorization: Bearer <YOUR_API_KEY>"

Tasks are async: poll until the status indicates completion, then retrieve the video URL from the result. You are billed per second of generated video based on the requested duration.