Compose music

Compose a song from a prompt or a composition plan.

Headers

xi-api-keystringRequired

Query parameters

output_formatenumOptionalDefaults to mp3_44100_128

Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs.

Request

This endpoint expects an object.
promptstring or nullOptional<=2000 characters

A simple text prompt to generate a song from. Cannot be used in conjunction with composition_plan.

composition_planobject or nullOptional

A detailed composition plan to guide music generation. Cannot be used in conjunction with prompt.

music_length_msinteger or nullOptional>=10000<=300000

The length of the song to generate in milliseconds. Used only in conjunction with prompt. Must be between 10000ms and 300000ms. Optional - if not provided, the model will choose a length based on the prompt.

model_idenumOptionalDefaults to music_v1
The model to use for the generation.
Allowed values:

Response

The generated audio file in the format specified

Errors