generate_music
Generate background music / a soundtrack from a text description: instrumental (no vocals) by default — ideal to play under narration — or a song with your own words (pass lyrics). Returns request_id and cost in credits immediately; music takes ~1–3 min, so poll with wait_generation until COMPLETED, then output.audio.url is the mp3. Pass the resulting request_id as audio_request_id in compose_video to score a multi-scene video, or use the mp3 on its own. Describe mood/genre/tempo/instruments in the prompt (English works best).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "generate_music"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | No | Model-specific parameters from get_model input_schema.parameters, keyed by parameter name and merged with the fields above. Some parameters can change the cost of the call — get_model shows the reference pricing. A misspelled name, or a parameter this model is known not to apply, is rejected before the generation starts; the error lists the parameters the model declares. | |
| model | No | Model slug from list_models (a text-to-music model). Omit to use the default music model. | |
| style | No | Musical style kept separate from the description: genre, mood, instruments, tempo (default model: up to 1,000 characters). Only for models with a custom mode, such as the default one; a model without it rejects the call. | |
| lyrics | No | Your own song text, sung as written (default model: up to 5,000 characters). Makes the track vocal — instrumental is set to false unless you pass it yourself. Omit to let the model write the words. Only for models with a custom-lyrics mode, such as the default one; a model without it rejects the call. | |
| prompt | Yes | Description of the music: mood, genre, tempo, instruments, e.g. "warm lo-fi hip-hop, mellow Rhodes piano, soft vinyl crackle, 80 bpm". English works best. On the default model: up to 3,000 characters, and a description longer than 1,000 characters also needs style or lyrics. A request that breaks the limits is rejected with 400 before anything is charged. | |
| instrumental | No | true (default) = instrumental, no vocals — best as a soundtrack under narration. false = allow vocals / a full song. Do not combine true with lyrics. | |
| wait_seconds | No | How long to wait inline for completion before returning a request_id (music usually needs polling with wait_generation). | |
| idempotency_key | No | Optional stable key (up to 255 characters) to safely retry without creating a duplicate generation. Reuse the same key only when retrying the same request: the same key with a different model or input is rejected with idempotency_key_reuse. |