curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
--header 'apiKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "kwaivgi/kling-video/v3/4k/text-to-video",
"params": {
"prompt": "Close-up of glowing fireflies dancing in a dark forest at twilight. Soft bioluminescent particles float through the air. Shallow depth of field, bokeh lights in background. Magical atmosphere, gentle movement.",
"duration": 5,
"shot_type": "customize",
"generate_audio": true
}
}'
const response = await fetch("https://restapi.scalingtensor.com/api/media/generate", {
method: "POST",
headers: {
apiKey: process.env.SCALINGTENSOR_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "kwaivgi/kling-video/v3/4k/text-to-video",
"params": {
"prompt": "Close-up of glowing fireflies dancing in a dark forest at twilight. Soft bioluminescent particles float through the air. Shallow depth of field, bokeh lights in background. Magical atmosphere, gentle movement.",
"duration": 5,
"shot_type": "customize",
"generate_audio": true
}
}),
});
const result = await response.json();
if (!response.ok || result.code !== 0) {
throw new Error(result.msg || `Request failed: ${response.status}`);
}
console.log(result.data); // Save data.jobId to query /api/media/result
import os
import requests
payload = {
"model": "kwaivgi/kling-video/v3/4k/text-to-video",
"params": {
"prompt": "Close-up of glowing fireflies dancing in a dark forest at twilight. Soft bioluminescent particles float through the air. Shallow depth of field, bokeh lights in background. Magical atmosphere, gentle movement.",
"duration": 5,
"shot_type": "customize",
"generate_audio": True,
},
}
response = requests.post(
"https://restapi.scalingtensor.com/api/media/generate",
headers={"apiKey": os.environ["SCALINGTENSOR_API_KEY"]},
json=payload,
timeout=60,
)
result = response.json()
if result["code"] != 0:
raise RuntimeError(result["msg"])
print(result["data"]) # Save data["jobId"] to query /api/media/result