const API_KEY = "<YOUR_API_KEY>";
const BASE_API_URL = "https://open.ppt.video/api";
async function createTask() {
const res = await fetch(`${BASE_API_URL}/v1/generation/google/veo-3.1`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
prompt: "sunrise over mountains in watercolor style"
})
});
if (!res.ok) {
throw new Error(`create failed: ${res.status} ${await res.text()}`);
}
const data = await res.json(); // { id, status, ... }
console.log("created task:", data.id);
return data.id;
}