Skip to main content

Generate AI Music (v5)

This endpoint generates instrumental AI music without vocals using advanced AI models. Available in both streaming and synchronous modes.

Core Parameters

The parameters below define the request body for this API.
ParameterTypeRequired?Description
userIdstring✅ RequiredUser ID requesting the operation.
projectIdstring✅ RequiredProject ID for organizing generations.
promptstring✅ RequiredPrompt describing the music you want to generate (e.g., “Upbeat electronic dance music with synth melodies”).
durationinteger⚠️ OptionalDuration in seconds. Default: 30.
stylestring⚠️ OptionalMusical style (e.g., “electronic”, “jazz”, “rock”, “ambient”).
modelstring⚠️ OptionalAI model to use. Default: mureka-7.5.
parametersobject⚠️ OptionalAdditional parameters for advanced customization.
Note: This endpoint generates instrumental music only (no vocals). For songs with vocals, use the /v5/generate/song-gen endpoint instead.

Endpoints

This API provides two endpoints:
  1. Streaming Endpoint (/v5/generate/music-gen): Returns real-time progress updates via Server-Sent Events (SSE)
  2. Synchronous Endpoint (/v5/generate/music-gen/sync): Waits for completion and returns the final result

Request Body

{
  "userId": "string",
  "projectId": "string",
  "prompt": "string",
  "duration": 30,
  "style": "string",
  "model": "mureka-7.5",
  "parameters": {}
}

Code Samples

import requests
import json

url = "https://api.soundverse.ai/v5/generate/music-gen"
headers = {
    "Authorization": "Bearer your_api_key_here",
    "Content-Type": "application/json"
}
payload = {
    "userId": "your_user_id",
    "projectId": "your_project_id",
    "prompt": "Upbeat electronic dance music with synth melodies and a driving bassline",
    "duration": 30,
    "style": "electronic"
}

response = requests.post(url, json=payload, headers=headers, stream=True)

# Process streaming response
for line in response.iter_lines():
    if line:
        data = json.loads(line.decode('utf-8'))
        print(data)

Response

{
  "content": "Starting music generation...",
  "isComplete": false,
  "chunkIndex": 1,
  "tokens": 10,
  "totalTokens": 10,
  "task_id": null,
  "status": null,
  "album_art": null,
  "song_name": null,
  "error": false
}
Streaming chunks continue until isComplete: true:
{
  "content": "Music generation completed successfully!",
  "isComplete": true,
  "chunkIndex": 5,
  "tokens": 150,
  "totalTokens": 500,
  "task_id": "123456789",
  "status": "COMPLETED",
  "album_art": "https://storage.soundverse.ai/.../album_art.png",
  "song_name": "Electronic Dreams",
  "audio_url": "https://storage.soundverse.ai/.../music.mp3",
  "error": false
}

Response Fields

FieldTypeDescription
successbooleanWhether the request was successful (synchronous endpoint only).
messageIdstringUnique identifier for the generation request.
audio_urlstringDirect URL to download/stream the generated audio.
album_artstringURL to the generated album artwork.
song_namestringName/title of the generated music track.
statusstringStatus of the generation (e.g., “COMPLETED”, “PROCESSING”).
contentstringProgress message (streaming endpoint only).
isCompletebooleanWhether generation is complete (streaming endpoint only).
chunkIndexintegerCurrent chunk index (streaming endpoint only).
task_idstringTask ID from the generation service (streaming endpoint only).

Sample Output

Synchronous Response:
{
  "success": true,
  "messageId": "6937bbb3d86e0fd7b969dbf1",
  "audio_url": "https://storage.soundverse.ai/x-one/69344de79f665b78cb97f347/userData/audios/music_1765054186.mp3",
  "album_art": "https://storage.soundverse.ai/x-one/69344de79f665b78cb97f347/userData/album-arts/album_art_1765054186.webp",
  "song_name": "Electronic Dreams",
  "status": "COMPLETED"
}
Streaming Response (Final Chunk):
{
  "content": "✅ Music generation completed successfully!",
  "isComplete": true,
  "chunkIndex": 5,
  "tokens": 150,
  "totalTokens": 500,
  "task_id": "123456789",
  "status": "COMPLETED",
  "album_art": "https://storage.soundverse.ai/x-one/69344de79f665b78cb97f347/userData/album-arts/album_art_1765054186.webp",
  "song_name": "Electronic Dreams",
  "audio_url": "https://storage.soundverse.ai/x-one/69344de79f665b78cb97f347/userData/audios/music_1765054186.mp3",
  "error": false
}

Possible Errors

  • Rate Limit Exceeded:
{
  "success": false,
  "message": "Rate limits have been passed for the user."
}
  • Insufficient Balance:
{
  "success": false,
  "message": "Insufficient balance for this operation."
}
  • Invalid Prompt:
{
  "detail": "Invalid or empty prompt provided"
}

Notes

  • Streaming vs Synchronous: Use the streaming endpoint (/music-gen) for real-time progress updates, or the synchronous endpoint (/music-gen/sync) for a simple request-response pattern.
  • Instrumental Only: This endpoint generates instrumental music without vocals. For songs with vocals, use /v5/generate/song-gen.
  • Duration: The duration parameter controls the target length of the generated music in seconds.
  • Style: The style parameter helps guide the musical direction (e.g., “electronic”, “jazz”, “rock”, “ambient”).
  • Billing: This endpoint uses enterprise billing. Charges are deducted from your account balance based on the selected model and license type.