const url = "https://api.soundverse.ai/v7/generate/remix";
const headers = {
Authorization: "Bearer your_api_key_here",
"Content-Type": "application/json",
};
const payload = {
song_reference_url: "https://storage.soundverse.ai/.../original_song.mp3",
prompt: "upbeat jazz remix with brass horns",
};
const response = await fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n');
lines.forEach(line => {
if (line.startsWith('data: ')) {
const data = JSON.parse(line.slice(6));
console.log(data);
}
});
}