curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
--header 'apiKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "sandai/magi-2/reference-to-video",
"params": {
"images": [
"https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1280&auto=format&fit=crop"
],
"prompt": "Use the reference image for the beach scenery. Waves gently roll onto the sand as the camera slowly moves forward, with natural ocean sounds.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"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": "sandai/magi-2/reference-to-video",
"params": {
"images": [
"https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1280&auto=format&fit=crop"
],
"prompt": "Use the reference image for the beach scenery. Waves gently roll onto the sand as the camera slowly moves forward, with natural ocean sounds.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"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": "sandai/magi-2/reference-to-video",
"params": {
"images": [
"https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1280&auto=format&fit=crop",
],
"prompt": "Use the reference image for the beach scenery. Waves gently roll onto the sand as the camera slowly moves forward, with natural ocean sounds.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"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