Extend AI Song (v5)
- The API supports both streaming and synchronous responses
Endpoints
- POST
/v5/extend/song- streaming - POST
/v5/extend/song/sync- synchronous
Request Parameters
| Parameter | Type | Description | Required | Default Value |
|---|---|---|---|---|
audio_url | string | URL of the audio file to extend | Yes | N/A |
lyrics | string | Lyrics to guide the extension style and mood. | Yes | N/A |
prompt | string | Prompt to guide the extension style and mood. | No | N/A |
extend_at | integer | Position (in ms) to extend the song at [8000,420000] | Yes | N/A |
Example Request
{
"audio_url": "https://storage.soundverse.ai/.../original_song.mp3",
"lyrics": "These are the song lyrics to guide the extension",
}
Code Examples - Streaming
import requests
import json
url = "https://api.soundverse.ai/v5/extend/song"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
payload = {
"audio_url": "https://storage.soundverse.ai/.../original_song.mp3",
"lyrics": "These are the song lyrics to guide the extension",
}
response = requests.post(url, json=payload, headers=headers, stream=True)
# Process streaming response
for line in response.iter_lines():
if line:
text = line.decode('utf-8')
if text.startswith('data: '):
data = json.loads(text[6:])
print(data)
const url = "https://api.soundverse.ai/v5/extend/song";
const headers = {
Authorization: "Bearer your_api_key_here",
"Content-Type": "application/json",
};
const payload = {
audio_url: "https://storage.soundverse.ai/.../original_song.mp3",
lyrics: "These are the song lyrics to guide the extension",
};
const response = await fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n');
lines.forEach(line => {
if (line.startsWith('data: ')) {
const data = JSON.parse(line.slice(6));
console.log(data);
}
});
}
curl -X POST "https://api.soundverse.ai/v5/extend/song" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type": "application/json" \
-d '{
"audio_url": "https://storage.soundverse.ai/.../original_song.mp3",
"lyrics": "These are the song lyrics to guide the extension",
}' --no-buffer
Code Examples - Synchronous
import requests
url = "https://api.soundverse.ai/v5/extend/song/sync"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
payload = {
"audio_url": "https://storage.soundverse.ai/.../original_song.mp3",
"lyrics": "These are the song lyrics to guide the extension",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.soundverse.ai/v5/extend/song/sync";
const headers = {
Authorization: "Bearer your_api_key_here",
"Content-Type": "application/json",
};
const payload = {
audio_url: "https://storage.soundverse.ai/.../original_song.mp3",
lyrics: "These are the song lyrics to guide the extension",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
curl -X POST "https://api.soundverse.ai/v5/extend/song/sync" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type": "application/json" \
-d '{
"audio_url": "https://storage.soundverse.ai/.../original_song.mp3",
"lyrics": "These are the song lyrics to guide the extension",
}'
Streaming Response
Fields
🛈 The fields below are used in the chunks sent by SSE during the streaming process.
| Parameter | Type | Description |
|---|---|---|
isComplete | bool | Indicates if the streaming response is complete. |
status | string | Current status of the extension process. |
chunkIndex | integer | Index of the current chunk in the streaming sequence. |
message_id | string | Unique identifier for the extension request. |
stream_url | string | URL to access the generated audio stream when ready. |
version | integer | Version of the generated content. |
album_art | string | URL of the album art associated with the generated content. |
song_name | string | Name of the generated track. |
progress | integer | Progress percentage of the generation process. 0-100 |
streaming_ready | bool | Indicates if audio is ready for streaming. |
version | integer | Version number of the generated audio. |
audio_url | string | URL of the generated audio file. |
error | string | Error message if any issues occurred during processing. |
operation | string | Type of operation being performed (e.g., “extend_song”). |
- please check Streaming Responses for more details
Synchronous Response
Sample Synchronous Output
{
"message_id": "...",
"album_art": "https://storage.soundverse.ai/soundverse-album-art/...album_art.png",
"audio_data": [
{
"audio_url": "https://storage.soundverse.ai/x-one/.../.../extended_song_v1.mp3",
"song_name": "Extended Song",
"licenses": {
"licenses": "Royalty Free"
}
},
{
"audio_url": "https://storage.soundverse.ai/x-one/.../.../extended_song_v2.mp3",
"song_name": "Extended Song",
"licenses": {
"licenses": "Royalty Free"
}
}
],
"ai_reply": "Your song has been extended successfully."
}
Possible Errors
Rate Limit Exceeded:{
"success": false,
"message": "Rate limits have been passed for the user."
}
{
"success": false,
"message": "Insufficient balance for this operation."
}
{
"detail": "Invalid or empty prompt provided"
}
{
"success": false,
"message": "NSFW words detected. Please try again with different lyrics."
}
{
"success": false,
"message": "Service temporarily unavailable. Please try again in a moment.",
"error": "Database connection pool exhausted"
}

