v5
latestOpenAPI 3.1.02026-08-043621,4011.8 MBmusic-generation
Compose Music
Compose a song from a prompt or a composition plan.
post/v1/music
Query parameters
output_format'auto' | 'mp3_48000_128' | 'mp3_48000_192' | 'mp3_48000_240' | 'mp3_48000_320' | 'mp3_22050_32' | 'mp3_24000_48' | 'mp3_44100_32' | 'mp3_44100_64' | 'mp3_44100_96' | 'mp3_44100_128' | 'mp3_44100_192' | 'pcm_8000' | 'pcm_16000' | 'pcm_22050' | 'pcm_24000' | 'pcm_32000' | 'pcm_44100' | 'pcm_48000' | 'ulaw_8000' | 'alaw_8000' | 'opus_48000_32' | 'opus_48000_64' | 'opus_48000_96' | 'opus_48000_128' | 'opus_48000_192'
Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models.
Headers
xi-api-keystring nullable
Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.
Your API key. This is required by most endpoints to access our API programmatically. You can view your xi-api-key using the 'Profile' tab on the website.
Request body
Example request
{
"music_prompt": {
"negative_global_styles": [
"metal",
"hip-hop",
"country"
],
"positive_global_styles": [
"pop",
"rock",
"jazz"
],
"sections": [
{
"duration_ms": 10000,
"lines": [
"Verse 1 lyrics"
],
"negative_local_styles": [
"metal",
"hip-hop",
"country"
],
"positive_local_styles": [
"pop",
"rock",
"jazz"
],
"section_name": "Verse 1"
}
]
},
"composition_plan": {
"negative_global_styles": [
"metal",
"hip-hop",
"country"
],
"positive_global_styles": [
"pop",
"rock",
"jazz"
],
"sections": [
{
"duration_ms": 10000,
"lines": [
"Verse 1 lyrics"
],
"negative_local_styles": [
"metal",
"hip-hop",
"country"
],
"positive_local_styles": [
"pop",
"rock",
"jazz"
],
"section_name": "Verse 1"
}
]
}
}Response
The generated audio file in the format specified