跳转至

MaaS_Mureka API

以下文档仅适用于MaaS_Mureka_o2、MaaS_Mureka_v7.6模型。若要了解 MaaS_Mureka_o1 、MaaS_Mureka_v7.5 模型接口文档请参考:MaaS_Mureka_v7.5

请求协议

Http

参数名
Authorization Bearer {YOUR AK}
Content-Type application/json

生成歌曲

请求方法

POST

请求URL

https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/song/generate

请求参数

字段 类型 必填 说明
lyrics string 歌词内容 (必须)
n int 每次请求生成的歌曲数量,最大值为 3,缺省为 2
prompt string 歌曲提示词,最多可输入 1024 个字符。 选择此选项后,其他控制选项(reference_id、vocal_id、melody_id)将无法选择。
reference_id string 参考音乐 ID,由 files/upload API 生成(purpose: reference) 选中此选项后,其他控制选项(prompt, melody_id)将无法选择。
vocal_id string 音色 ID,由 files/upload API 生成(purpose: vocal) 选择此选项后,其他控制选项(prompt, melody_id)将无法选择
melody_id string 旋律 ID,由 files/upload API 生成(purpose: melody) 选择此选项后,其他控制选项(prompt, reference_id, vocal_id)将无法选择。
stream boolean 如果设置为 true,生成任务的状态将包含一个流式传输阶段。 在此阶段,您可以获取已生成歌曲的 stream_url 并播放该 URL,从而实现在生成过程中播放歌曲。 当模型为 mureka-o1 时,不支持此模式

请求示例

curl -X 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/song/generate' \
-H 'Authorization:  Bearer ${Your AK}' \
-H 'Content-Type:  application/json' \
-d '{
  "lyrics": "【Verse 1】\n青春如花绽放\n梦想在心中飞翔\n\n【Chorus】\n青春与梦想\n永远在心中",
  "n": 1,
  "stream": true,
  "prompt": "创作一首关于青春梦想的流行歌曲"
}'

响应参数

字段名 类型 说明
taskId string 异步歌曲生成任务的 ID。
created_at integer 任务创建时的 Unix 时间戳(秒)。
finished_at integer 任务完成时的 Unix 时间戳(秒)。
model string 用于歌曲生成的模型。
status string 任务当前状态。\
有效值:preparing, queued, running, streaming, succeeded, failed, timeouted, cancelled
failed_reason string 失败原因。

响应示例

{
    "code": 0,
    "data": {
        "taskId": "113923099721729",
        "trace_id": "eb174f86b6c59ba838ce4401b01678eb",
        "created_at": 1767001167,
        "finished_at": null,
        "model": "MaaS_Mureka_v7.6",
        "status": "preparing",
        "failed_reason": null,
        "watermarked": null,
        "choices": null
    },
    "code_msg": "success",
    "trace_id": "eb174f86b6c59ba838ce4401b01678eb"
}

续写歌曲

请求方法

POST

请求URL

https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/song/extend

请求参数

字段 类型 必填 说明
song_id string 用于扩展的歌曲 ID,由 song/generate API 生成。 与 upload_audio_id 参数互斥
upload_audio_id string 参考音乐 ID,由 files/upload API 生成(purpose: reference)
lyrics string 歌词内容 (必须)
extend_at string 延长开始时间(毫秒)。如果大于歌曲时长,则默认为歌曲时长。 有效范围:[8000,420000]

请求示例

curl -X 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/song/extend' \
-H 'Authorization:  Bearer ${Your AK}' \
-H 'Content-Type:  application/json' \
-d '{
  "song_id": "113875917733890",
  "extend_at": "8000",
  "lyrics": "[Verse]\nIn the stormy night, I wander alone\nLost in the rain, feeling like I have been thrown\nMemories of you, they flash before my eyes\nHoping for a moment, just to find some bliss"
}'

响应参数

字段名 类型 说明
taskId string 异步歌曲生成任务的 ID。
created_at integer 任务创建时的 Unix 时间戳(秒)。
finished_at integer 任务完成时的 Unix 时间戳(秒)。
model string 用于歌曲生成的模型。
status string 任务当前状态。\
有效值:preparing, queued, running, streaming, succeeded, failed, timeouted, cancelled
failed_reason string 失败原因。

响应示例

{
    "code": 0,
    "data": {
        "taskId": "113893286346753",
        "trace_id": "22b0306de94dd63dc555719b66460e54",
        "created_at": 1767001167,
        "finished_at": null,
        "model": "MaaS_Mureka_v7.6",
        "status": "preparing",
        "failed_reason": null,
        "watermarked": null,
        "choices": null
    },
    "code_msg": "success",
    "trace_id": "eb174f86b6c59ba838ce4401b01678eb"
}

查询任务(歌曲)

生成/续写歌曲任务均通过该接口查询

请求方法

GET

请求URL

https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/song/query/{task_id}

请求示例

curl -X 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/song/query/{task_id}' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ${Your AK}'

响应参数

字段名 类型 说明
taskId string 异步歌曲生成任务的 ID。
created_at integer 任务创建时的 Unix 时间戳(秒)。
finished_at integer 任务完成时的 Unix 时间戳(秒)。
model string 用于歌曲生成的模型。
status string 任务当前状态。\
有效值:preparing, queued, running, streaming, succeeded, failed, timeouted, cancelled
failed_reason string 失败原因。
choices.index integer 歌曲在选择列表中的索引。
choices.id string 生成歌曲的 ID。
choices.url string 生成歌曲的 URL,有效时间为一个月。
choices.flac_url string 无损 FLAC 格式音频的 URL,有效时间为一个月。
choices.wav_url string 无损 WAV 格式音频的 URL,有效时间为一个月。
choices.stream_url string 当请求参数 stream 设置为 true 时,流媒体播放阶段可用的 URL。
choices.duration integer 歌曲时长(毫秒)
choices.lyrics_sections.section_type string 分段类型。\
有效值:intro, verse, pre-chorus, chorus, bridge, break, outro
choices.lyrics_sections.start integer 分段开始时间(毫秒)
choices.lyrics_sections.end integer 分段结束时间(毫秒)
choices.lyrics_sections.lines.start integer 歌词行开始时间(毫秒)
choices.lyrics_sections.lines.end integer 歌词行结束时间(毫秒)
choices.lyrics_sections.lines.text string 歌词行中的文本内容。
choices.lyrics_sections.lines.words.start integer 单词开始时间(毫秒)
choices.lyrics_sections.lines.words.end integer 单词结束时间(毫秒)
choices.lyrics_sections.lines.words.text string 单词内容。

响应示例

{
    "code": 0,
    "data": {
        "taskId": "113905426890753",
        "trace_id": "bddd741b9119d64492e811966dc35a73",
        "created_at": 1766992740,
        "finished_at": 1766992759,
        "model": "MaaS_Mureka_v7.6",
        "status": "succeeded",
        "failed_reason": null,
        "watermarked": null,
        "choices": [
            {
                "index": null,
                "id": "113905464770561",
                "url": "https://cdn.mureka.ai/cos-prod/open/song/20251229/113366463152129-9DDrRrRu26n4iifY3Rgbyb.mp3",
                "wav_url": "https://cdn.mureka.ai/cos-prod/open/song/20251229/113366463152129-DY7ihYqasXszEqM4tvpYNj.wav",
                "flac_url": "https://cdn.mureka.ai/cos-prod/open/song/20251229/113366463152129-DY7ihYqasXszEqM4tvpYNj.flac",
                "stream_url": null,
                "duration": 41540,
                "lyrics_sections": [
                    {
                        "section_type": "intro",
                        "start": 2400,
                        "end": 2800,
                        "lines": [
                            {
                                "start": 2400,
                                "end": 2800,
                                "text": "Float song",
                                "words": [
                                    {
                                        "start": 2400,
                                        "end": 2760,
                                        "text": "Float "
                                    },
                                    {
                                        "start": 2760,
                                        "end": 2800,
                                        "text": "song"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    },
    "code_msg": "success",
    "trace_id": "bddd741b9119d64492e811966dc35a73"
}

上传文件

请求方法

POST

请求URL

https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/files/upload

参数

form-data提交参数

字段名 类型 必填 说明
file file 要上传的文件内容
purpose string 文件用途 有效取值: reference, vocal, melody, instrumental, voice, audio reference:支持的格式为mp3、m4a。支持的音频时长范围为[30,30]秒,超出部分将被裁剪。 vocal:支持格式(mp3、m4a)。使用从上传音频中提取的人声。支持的人声时长范围为 15 至 30 秒,超出部分将被剪掉。 melody:支持格式(mp3、m4a、mid)。使用从上传音频中提取的人声,建议上传 MIDI 文件。支持的音频时长范围为 5 到 60 秒,超出部分将被剪掉。 instrumental:支持的格式为 (mp3, m4a)。支持的音频时长范围为 [30,30] 秒,超出部分将被剪掉。 voice:支持格式(mp3、m4a)。支持的音频时长范围为[5,15]秒,超出部分将被剪掉。 audio:支持的格式(mp3、m4a)。常见的音频文件格式,用于歌曲扩展等用途。

请求示例

curl -X 'https://genaiapi.cloudsway.net/v1/ai/${Your endpoint}/mureka/files/upload' \
-H 'Authorization: Bearer ${Your AK}' \
-F 'file=@"/C:/Users/user/Downloads/music_songs_20251110.mp3"' \
-F 'purpose="audio"'

响应参数

字段名 类型 说明
id string 文件标识符,可用于在 API 接口中引用该文件。
bytes integer 文件大小,单位为字节。
created_at integer 文件创建时的 Unix 时间戳(秒)
filename string 文件名称
purpose string 文件的预期用途

响应示例

{
    "trace_id": "b4f3edecf8288f19652102e17eab3c91",
    "purpose": "audio",
    "created_at": 1767059534,
    "filename": "113366463152129-RcQK1qzNt73VBNCcW3JoQ6.mp3",
    "bytes": 3637542,
    "id": "114045503930371"
}