import AudioPod from 'audiopod';
const client = new AudioPod({ apiKey: 'ap_your_api_key' });
// Six-stem separation from YouTube
const result = await client.stems.separate({
url: 'https://youtube.com/watch?v=VIDEO_ID',
mode: 'six'
});
console.log(result.download_urls);
// From local file
const result = await client.stems.separate({
file: './song.mp3',
mode: 'four'
});
// Extract only vocals
const result = await client.stems.separate({
url: 'https://youtube.com/watch?v=VIDEO_ID',
mode: 'single',
stem: 'vocals'
});
// Async job handling (for more control)
const job = await client.stems.extract({
url: 'https://youtube.com/watch?v=VIDEO_ID',
mode: 'six'
});
console.log(`Job ID: ${job.id}`);
// Wait for completion
const result = await client.stems.waitForCompletion(job.id);
// Get available modes
const modes = await client.stems.modes();
modes.modes.forEach(m => {
console.log(`${m.mode}: ${m.description}`);
});