Audio

Generate background music

Deprecated, sunset 2027-01-15. Use /api/v1/music-generations instead. Generates an instrumental or vocal background-music track from a text prompt. lengthMs (3000-120000, default 10000) is forced on the provider, so the generated track always matches the billed length; credits are reserved before generation and refunded if it fails. The default encoding: "binary" returns the raw audio bytes; encoding: "base64" returns JSON. Audio over the ~4MB response ceiling is returned by signed URL (a 303 for binary, the delivery: "url" variant for base64). Generated audio is saved to the file browser unless the call sets preview; the outcome is reported in the JSON save fields and the X-B4M-Audio-* headers - fetch the saved copy from fileUrl / X-B4M-Audio-File-Url, since GET /api/files/{id} fails closed until moderation completes. Authenticate with an API key (b4m_live_) or a JWT.

post/api/ai/music

Request

  • Base URL: https://your-deployment.example.com
  • URL: https://your-deployment.example.com/api/ai/music
  • Auth: one of:
    • HTTP bearer
    • API key in header x-api-key

Request body

provider'elevenlabs'
promptstring required
lengthMsinteger
forceInstrumentalboolean
modelId'music_v1'
formatstring
encoding'binary' | 'base64'
previewboolean

Example request

{
  "prompt": "calm lo-fi study beat with soft piano",
  "lengthMs": 30000,
  "forceInstrumental": true
}

Response

Music generated. Binary bodies carry a Content-Type that follows the requested format (mp3 by default). The default encoding: "binary" returns the raw audio bytes; encoding: "base64" returns the JSON body. Audio over the ~4MB response ceiling cannot ride in the body: the binary encoding answers 303 instead, and the base64 encoding returns the delivery: "url" variant, whose url is a time-limited signed GET for the audio (bytes is its size).

OR

Changes

No recorded changes to this operation across all 1 revision of this API.