## Basic model info - Model name: elevenlabs/elevenlabs music-v1 - Model description: undefined - Endpoint name: text-to-music ## Model schema The model schema is defined in the OpenAPI schema: [OpenAPI Schema](https://oapi.sunra.ai/main/elevenlabs/music-v1/latest.json) ### Model input schema The model input schema is: ```json { "description": "Input schema for ElevenLabs Music generation.", "properties": { "prompt": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "A simple text prompt to generate a song from. Cannot be used in conjunction with composition_plan.", "title": "Prompt", "x-sr-order": 200 }, "seed": { "anyOf": [ { "maximum": 2147483647, "minimum": 0, "type": "integer" }, { "type": "null" } ], "description": "Random seed for more consistent results. Cannot be used in conjunction with prompt.", "title": "Seed", "x-sr-order": 403 }, "composition_plan": { "anyOf": [ { "description": "A detailed composition plan to guide music generation.", "properties": { "negative_global_styles": { "description": "The styles and musical directions that should not be present in the entire song.", "items": { "type": "string" }, "title": "Negative Global Styles", "type": "array" }, "positive_global_styles": { "description": "The styles and musical directions that should be present in the entire song.", "items": { "type": "string" }, "title": "Positive Global Styles", "type": "array" }, "sections": { "description": "The sections of the song.", "items": { "description": "A section of the song composition plan.", "properties": { "duration_ms": { "description": "The duration of the section in milliseconds. Must be between 3000ms and 120000ms.", "maximum": 120000, "minimum": 3000, "title": "Duration Ms", "type": "integer" }, "lines": { "description": "The lyrics of the section. Each line must be at most 200 characters long.", "items": { "type": "string" }, "title": "Lines", "type": "array" }, "negative_local_styles": { "description": "The styles and musical directions that should not be present in this section.", "items": { "type": "string" }, "title": "Negative Local Styles", "type": "array" }, "positive_local_styles": { "description": "The styles and musical directions that should be present in this section.", "items": { "type": "string" }, "title": "Positive Local Styles", "type": "array" }, "section_name": { "description": "The name of the section. Must be between 1 and 100 characters.", "maxLength": 100, "minLength": 1, "title": "Section Name", "type": "string" } }, "required": [ "section_name", "positive_local_styles", "negative_local_styles", "duration_ms", "lines" ], "title": "MusicSection", "type": "object" }, "title": "Sections", "type": "array" } }, "required": [ "positive_global_styles", "negative_global_styles", "sections" ], "title": "MusicCompositionPlan", "type": "object" }, { "type": "null" } ], "description": "A detailed composition plan to guide music generation. Cannot be used in conjunction with prompt.", "x-sr-order": 300 }, "force_instrumental": { "default": false, "description": "If true, guarantees that the generated song will be instrumental. Can only be used with prompt.", "title": "Force Instrumental", "type": "boolean", "x-sr-order": 401 }, "music_length_ms": { "anyOf": [ { "maximum": 600000, "minimum": 3000, "type": "integer" }, { "type": "null" } ], "description": "The length of the song to generate in milliseconds. Used only in conjunction with prompt. Must be between 3000ms and 600000ms.", "title": "Music Length Ms", "x-sr-order": 400 }, "output_format": { "default": "mp3_44100_128", "description": "Output format of the generated audio.", "enum": [ "mp3_22050_32", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192", "pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000", "alaw_8000", "opus_48000_32", "opus_48000_64", "opus_48000_96", "opus_48000_128", "opus_48000_192" ], "title": "Output Format", "type": "string", "x-sr-order": 500 }, "respect_sections_durations": { "default": true, "description": "Controls how strictly section durations in the composition_plan are enforced. When true, the model will precisely respect each section's duration_ms. When false, the model may adjust individual section durations for better quality.", "title": "Respect Sections Durations", "type": "boolean", "x-sr-order": 402 } }, "title": "TextToMusicInput", "type": "object" } ``` ### Model output schema The model output schema is: ```json { "description": "Output schema for ElevenLabs Music generation.", "properties": { "audio": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, "output_audio_duration": { "title": "Output Audio Duration", "type": "integer" } }, "required": [ "audio", "output_audio_duration" ], "title": "MusicOutput", "type": "object" } ``` ## Example inputs and outputs Use the following example inputs and outputs to understand the model. ### Input example ```json { "prompt": null, "seed": null, "composition_plan": null, "force_instrumental": false, "music_length_ms": null, "output_format": "mp3_44100_128", "respect_sections_durations": true } ``` ### Output example ```json { } ``` ## Model code examples ### JavaScript ```javascript import { sunra } from "@sunra/client"; const result = await sunra.subscribe("elevenlabs/music-v1/text-to-music", { input: { prompt: null, composition_plan: null, music_length_ms: null, force_instrumental: false, respect_sections_durations: true, seed: null, output_format: 'mp3_44100_128' }, logs: true, onQueueUpdate: (update) => { console.log(`Status Update: ${update.status}, Request ID: ${update.request_id}`); }, }); console.log(result.data); console.log(result.requestId); ``` ### Python ```python import sunra_client result = sunra_client.subscribe( "elevenlabs/music-v1/text-to-music", arguments={ "prompt": None, "composition_plan": None, "music_length_ms": None, "force_instrumental": False, "respect_sections_durations": True, "seed": None, "output_format": "mp3_44100_128" }, with_logs=True, on_enqueue=print, on_queue_update=print, ) print(result) ``` ### Java ```java import ai.sunra.client.*; import java.util.Map; import com.google.gson.JsonObject; var client = SunraClient.withEnvCredentials(); var response = client.subscribe( "elevenlabs/music-v1/text-to-music", SubscribeOptions.builder() .input(Map.of( "prompt", null, "composition_plan", null, "music_length_ms", null, "force_instrumental", false, "respect_sections_durations", true, "seed", null, "output_format", "mp3_44100_128")) .resultType(JsonObject.class) .onQueueUpdate(update -> System.out.printf( "\nStatus Update: %s, Request ID: %s%n", update.getStatus(), update.getRequestId() )) .logs(true) .build() ); System.out.println("Completed!"); System.out.println(response.getData()); ``` ### Kotlin ```kotlin import ai.sunra.client.kt.* import com.google.gson.JsonObject val client = createSunraClient() val response = client.subscribe( endpointId = "elevenlabs/music-v1/text-to-music", input = mapOf( "prompt" to null, "composition_plan" to null, "music_length_ms" to null, "force_instrumental" to false, "respect_sections_durations" to true, "seed" to null, "output_format" to "mp3_44100_128"), options = ai.sunra.client.kt.SubscribeOptions(logs = true), onUpdate = { update -> println("\nStatus Update: ${update.status}, Request ID: ${update.requestId}") } ) println("Completed!") println(response.data) ``` ### Curl ```bash curl --request POST \ --url https://api.sunra.ai/v1/queue/elevenlabs/music-v1/text-to-music \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"prompt":null,"composition_plan":null,"music_length_ms":null,"force_instrumental":false,"respect_sections_durations":true,"seed":null,"output_format":"mp3_44100_128"}' ``` ## Model readme undefined