Generate music
POST /music generates one music file from a prompt and a duration. Promo soundtracks still run inside promo generation, where the music is mixed into the video.
curl -sS -X POST "$BRAIV_API_BASE/music" \ -H "Authorization: Bearer $BRAIV_API_KEY" \ -H "Content-Type: application/json" \ -d '{"prompt":"Warm piano and soft strings, hopeful and unhurried","duration":45}'The response is 202:
{"musicId":"mus_01","jobId":"music_mus_01","creditsSpent":20,"balance":80}Poll GET /jobs/music_mus_01 or GET /music/mus_01 until status is ready or failed. A ready generation includes audioUrl, a signed mp3 link that lasts one hour. Request another GET for a fresh link.
| Field | Rule |
|---|---|
prompt | Required. Trimmed. At most 2000 characters. Sent to the model as written. |
duration | Required. Seconds, from 1 to 380. |
| Cost | 20 credits, debited when the job is queued. Refunded if generation fails. |
Required scope: music:write. The same scope reads the generation. A caller can only read generations they created.
Endpoint details: createMusic and getMusic.