Node.js · Social Media music
Social Media Music API for Node.js
Node.js developers who need to generate short-form social clips programmatically and want the exact Node.js snippet for their stack.
Example prompt for social media music
punchy upbeat hook for a short-form vertical videoInstall
npm install @musicapi/sdkNode.js quick start
Set MUSICAPI_KEY, paste this, and run it. It is a real request against the live API, prompted for social media music.
// 1) start a generation
const res = await fetch("https://api.musicapi.ai/api/v1/sonic/create", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MUSICAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
custom_mode: false,
mv: "sonic-v5",
gpt_description_prompt: "punchy upbeat hook for a short-form vertical video",
}),
})
const { task_id } = await res.json()
// 2) poll GET /api/v1/sonic/task/{task_id} until data[0].audio_url is setFull Node.js setup (SDK, polling helper, error handling) is on the Node.js music API guide.
Why teams use it for social media
Using popular tracks on social clips risks takedowns, muted audio, and demonetization. A small shared library means every clip sounds alike and recycled audio can still trip content-ID systems. Creators need original music that is theirs and is safe to post.
More on this use case, including output and licensing details, on the Social Media Music API page.
FAQ
How do I generate social media music from Node.js?
POST a prompt to https://api.musicapi.ai/api/v1/sonic/create from Node.js with your API key, then poll the returned task_id at /api/v1/sonic/task/{task_id} until the audio URL is ready. The snippet above is a complete starting point.
What does it cost?
Each music generation is 15 credits (2 songs). New accounts get free signup credits with no card, then it is pay-as-you-go. See the per-operation table at musicapi.ai/pricing#credit-costs.
Where is the full Node.js setup?
This page is the social media-focused quick start. The complete Node.js integration (install, polling helper, error handling) is at musicapi.ai/nodejs-music-api.
Generate social media music in minutes
Get free credits on signup and run real generations before any payment. No credit card required to start.
API details verified 2026-06-07. The pricing page always has current rates.