API parameters for the Fun-Music music generation model.
User guide: For model overview and selection guidance, see Music generation.
An API key is required. To get one, see Get an API key.
POST
Prerequisites
An API key is required. To get one, see Get an API key.
Endpoint
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/music/generation, Replace WorkspaceId with your actual workspace ID.
Protocol: HTTPS. For streaming output, set the X-DashScope-SSE request header to enable SSE (Server-Sent Events).
Request headers
Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes |
|
Content-Type | string | Yes |
|
X-DashScope-SSE | string | No | Set to |
Request bodymodelstring(required)Model name. Allowed values:
object(required)Input parameters.
Properties prompt string(conditionally required)A text prompt. The model automatically composes and generates music based on this prompt.
If both prompt and lyrics are provided, only lyrics takes effect and prompt is ignored.string(conditionally required)Lyrics for the generated song.
If both lyrics and prompt are provided, only lyrics takes effect and prompt is ignored.string(optional) Default: femaleVocal gender. Only supported by the fun-music-v1 model. Valid values:
string(optional) Default: mp3Audio encoding format. Valid values:
boolean(optional) Default: falseAIGC watermark switch. When enabled, a Morse code audio signal representing "AI" (·— ··) is appended to the end of the generated audio to identify the content as AI-generated. Enabling the watermark increases the audio duration. |
Response objectrequest_idstringRequest ID, used for troubleshooting and log tracing.outputobjectModel output.
Properties audio objectAudio output from the model.
Properties data stringBase64-encoded audio chunks in streaming mode. Empty string in non-streaming mode.url stringOSS URL of the complete audio file, valid for 24 hours. Present in all non-streaming responses and in the final streaming message only.id stringAudio file ID.expires_at integerUnix timestamp indicating when the audio URL expires.objectAdditional metadata about the generated audio.
Properties channels integerNumber of audio channels. For example, 2 indicates stereo.sample_rate stringAudio sample rate. For example, "48000".lyrics stringLyrics of the generated song.stringGeneration status:
objectBilling information for this request.
Properties duration integerMusic duration in seconds, used for billing. |