Music Generation
Generate original, royalty-free music from text descriptions using AI.
Overview
The Music Generation API creates original compositions from natural language prompts. Control genre, tempo, duration, and output format to produce royalty-free tracks ready for any project. Stems separation lets you isolate individual instruments for remixing.
Quickstart
Generate a music track from a text description in just a few lines.
Generate Music
/v1/music/generateGenerate an original music track from a natural language description. The model interprets your prompt to determine instrumentation, mood, and structure. Optional parameters let you constrain genre, tempo, duration, and output format.
| Parameter | Type | Description |
|---|---|---|
| promptREQUIRED | string | Natural language description of the desired music. |
| duration | integer | Track length in seconds (5-300). Default: 30. |
| genre | string | Target genre (e.g., lo-fi, electronic, classical, rock, ambient). |
| tempo | integer | Tempo in BPM (40-220). Auto-detected from prompt if omitted. |
| output_format | string | Audio format: mp3, wav, flac, ogg. Default: mp3. |
Response
Get Track
/v1/music/{track_id}Retrieve a generated music track by its ID. The response includes download URLs, waveform data for visualization, and separated stems for remixing.
| Parameter | Type | Description |
|---|---|---|
| track_idREQUIRED | string | The unique identifier of the music track. |
Response
Response Objects
Reference for the objects returned by the Music Generation endpoints.
MusicTrack (Generate)
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the music track. |
| status | string | One of: pending, processing, completed, failed. |
| audio_url | string | URL to stream the generated audio. |
| duration | number | Track length in seconds. |
| genre | string | Detected or specified genre of the track. |
| tempo | integer | Tempo of the track in BPM. |
| prompt | string | The original text prompt used for generation. |
| created_at | string | ISO 8601 timestamp of track creation. |
MusicTrack (Get - Full)
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the music track. |
| status | string | One of: pending, processing, completed, failed. |
| audio_url | string | URL to stream the generated audio. |
| download_url | string | Direct download URL for the audio file. |
| waveform_url | string | URL to the waveform data JSON for visualization. |
| duration | number | Track length in seconds. |
| genre | string | Detected or specified genre of the track. |
| tempo | integer | Tempo of the track in BPM. |
| prompt | string | The original text prompt used for generation. |
| created_at | string | ISO 8601 timestamp of track creation. |
| stems | object | Separated stems with URLs for vocals, drums, bass, and other. |
Best Practices
Write descriptive prompts
Include details about mood, instruments, and style. "Chill lo-fi beat with jazzy Rhodes piano, soft drums, and rain ambiance" produces far better results than "lo-fi music".
Use WAV for production, MP3 for previews
Generate preview tracks in MP3 for faster iteration, then re-generate your final selection in WAV or FLAC for lossless quality in production.
Leverage stems for custom mixes
Use the stems separation feature to isolate drums, bass, vocals, and other instruments. This lets you remix, adjust levels, or combine elements from multiple generations.
Set tempo explicitly for rhythmic content
If your project requires precise BPM (e.g., syncing to video), always specify the tempo parameter rather than relying on auto-detection from the prompt.