0%

Riffusion Audios Generation API 对接说明

申请流程

要使用 API,需要先到 Riffusion Audios Generation API 对应页面申请对应的服务,进入页面之后,点击「Acquire」按钮,如图所示:

如果你尚未登录或注册,会自动跳转到登录页面邀请您来注册和登录,登录注册之后会自动返回当前页面。

在首次申请时会有免费额度赠送,可以免费使用该 API。

基本使用

想些什么歌曲,可以任意输入一段文字,比如我想生成一个关于圣诞的歌曲,就可以输入 a song for Christmas,如图所示:

可以看到这里我们设置了 Request Headers,包括:

  • accept:想要接收怎样格式的响应结果,这里填写为 application/json,即 JSON 格式。
  • authorization:调用 API 的密钥,申请之后可以直接下拉选择。

另外 Request Body 的参数包括:

  • action:此次音乐生成任务的行为,生成歌曲是 generate
  • model:创建歌曲采用的模型,目前主要有:FUZZ-1.0FUZZ-1.1FUZZ-1.0 ProFUZZ-1.1 Pro
  • lyric:歌曲的歌词内容。
  • custom:是否采用自定义方式生成歌曲。
  • prompt:灵感模式下的提示词。
  • style:歌曲风格参数。
  • title:歌曲标题信息。
  • callback_url:需要回调结果的 URL。
  • instrumental:是否为无歌词模式。

如上参数和官方的自定义生成的映射关系如下:

  • model:对应 Riffusion 账号设置页面的模型选择,如下图所示
  • lyric:对应 Rifussion 自定义生成页面的「Lyrics」部分,如下图所示
  • style:对应 Rifussion 自定义生成页面的「Sound」部分,实际上是指定一些风格,如下图所示
  • title:对应 Rifussion 自定义生成页面的「Details」部分,用于指定歌曲标题,如下图所示
  • instrumental:对应 Rifussion 自定义生成页面的「Instrumental」开关,用于设置无歌词模式,如下图所示

选择之后,可以发现右侧也生成了对应代码,如图所示:

点击「Try」按钮即可进行测试,如上图所示,这里我们就得到了如下结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"success": true,
"task_id": "f45388a9-4169-41d4-aec8-fb8259c48d36",
"trace_id": "1df9f664-fd74-476b-8038-b0b5f62ddf87",
"data": [
{
"id": "02702b40-272d-4838-8644-675105930658",
"title": "Vibe",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/e850008a-d9a1-4c8f-acbd-a37f228946bc/image/02702b40-272d-4838-8644-675105930658.jpg",
"lyric": "[Intro]\nYeah, yeah\nKeep talking, keep talking\nI love the way you sound\n[Verse 1]\nYour voice is like a drug I can't put down\nEvery word you say just pulls me in\nI'm addicted to the way you laugh out loud\nAnd how you whisper when the room goes dim\nTell me 'bout your day, tell me 'bout your fears\nI could listen to you talk for years\n[Pre-Chorus]\nDon't stop now, don't you dare\nI need your voice filling up the air\n[Chorus]\nKeep talking, keep talking to me\nYour words are all I fucking need\nKeep talking, keep talking, I'm high\nOff every sound you make tonight\nKeep talking\n[Verse 2]\nYou could read the phone book, I don't care\nJust the rhythm of your breathing's enough\nWhen you say my name, it's like a prayer\nAnd your silence hits me twice as rough\nEvery conversation feels like home\nNever want to hear this dial tone\n[Pre-Chorus]\nDon't stop now, don't you dare\nI need your voice filling up the air\n[Chorus]\nKeep talking, keep talking to me\nYour words are all I fucking need\nKeep talking, keep talking, I'm high\nOff every sound you make tonight\nKeep talking\n[Bridge]\nWhen the world gets loud and crazy\nYour voice cuts through the noise\nYou're my favorite conversation\nYou're my drug of choice\nKeep talking, keep talking\nKeep talking, keep talking\nKeep talking, keep talking\nKeep talking, keep talking\n[Chorus]\nKeep talking, keep talking to me\nYour words are all I fucking need\nKeep talking, keep talking, I'm high\nOff every sound you make tonight\nKeep talking\n[Outro]\nYeah, yeah\nKeep talking, keep talking\nNever stop that sound",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/e850008a-d9a1-4c8f-acbd-a37f228946bc/audio/02702b40-272d-4838-8644-675105930658.m4a",
"video_url": null,
"created_at": "2025-06-18T15:47:54.705246Z",
"model": "FUZZ-1.0",
"lyrics_timestamped": {
"words": [
{
"text": "[Intro]",
"start": 0.64,
"end": 0.64,
"line_index": 0,
"index_range": null,
"wav2vec2_format": null
},
...
{
"text": "sound",
"start": 179.84,
"end": 180.48,
"line_index": 63,
"index_range": null,
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "Pop, upbeat tempo, modern production",
"duration": 181.12
},
{
"id": "be3fe757-621e-4017-9056-20aa7f01919e",
"title": "Revive",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/e850008a-d9a1-4c8f-acbd-a37f228946bc/image/be3fe757-621e-4017-9056-20aa7f01919e.jpg",
"lyric": "[Verse 1]\nI'm walking through the motions, moving day by day\nColors seem a little faded, nothing much to say\nFriends keep calling, asking if I'm doing fine\nBut I just smile and tell them everything's divine\n[Pre-Chorus]\nSomething's missing, can't quite name it\nFeels like I'm just going through the stages\n[Chorus]\nI'm barely breathing, barely feeling\nLike I'm floating through a life that isn't mine\nBarely breathing, barely healing\nSearching for a reason, searching for a sign\nTo feel alive again\nTo feel alive again\n[Verse 2]\nMorning coffee tastes like water, sunrise looks like rain\nEveryone around me laughs but I can't feel the same\nUsed to dance in silly moments, used to sing out loud\nNow I'm standing in the silence of a faceless crowd\n[Pre-Chorus]\nSomething's shifting, can't ignore it\nMaybe it's time to break these patterns\n[Chorus]\nI'm barely breathing, barely feeling\nLike I'm floating through a life that isn't mine\nBarely breathing, barely healing\nSearching for a reason, searching for a sign\nTo feel alive again\nTo feel alive again\n[Bridge]\nBut there's a beating in my chest\nA whisper saying \"don't give up yet\"\nMaybe tomorrow I'll remember\nHow to laugh and how to let\nMy heart wake up from this long sleep\nFind the fire I used to keep\n[Chorus]\nI'm barely breathing, barely feeling\nLike I'm floating through a life that isn't mine\nBarely breathing, barely healing\nSearching for a reason, searching for a sign\nTo feel alive again\nTo feel alive again\n[Outro]\nI'm gonna feel alive again\nI'm gonna feel alive again",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/e850008a-d9a1-4c8f-acbd-a37f228946bc/audio/be3fe757-621e-4017-9056-20aa7f01919e.m4a",
"video_url": null,
"created_at": "2025-06-18T15:48:01.139081Z",
"model": "FUZZ-1.0",
"lyrics_timestamped": {
"words": [
{
"text": "[Verse",
"start": 0.64,
"end": 0.64,
"line_index": 0,
"index_range": null,
"wav2vec2_format": null
},
...
{
"text": "again",
"start": 202.88,
"end": 211.84,
"line_index": 54,
"index_range": null,
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "Pop, upbeat tempo, clean production, emotional vocals",
"duration": 211.84
}
]
}

返回结果一共有多个字段,介绍如下:

  • success,此时音乐生成任务的状态情况。
    • data,此次音乐任务的结果 - id,此时音乐生成任务的 ID。
      • prompt,此时音乐生成任务的提示词。
      • audio_url,此时音乐生成任务的音频链接。
      • image_url,此时音乐生成任务的封面链接。
      • state,此时音乐生成任务的状态。
      • duration,此时音乐的时长信息。
      • style,此时音乐的风格信息。
      • model,此时音乐生成任务采用的模型信息。
      • lyric,此时音乐生成任务的歌词信息。

可以看到我们得到了想生成的音乐信息,我们只需要根据结果中 data 的音乐链接地址获取生成的 Riffusion 音乐即可。

另外如果想生成对应的对接代码,可以直接复制生成,例如 CURL 的代码如下:

1
2
3
4
5
6
7
8
9
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"model": "FUZZ-1.0",
"action": "generate",
"prompt": "A song for Christmas"
}'

自定义生成

如果想自定义生成歌词,可以输入歌词:

这时候 lyric 字段可以传入类似如下内容:

1
[Verse]Woke up with the sun in my eyesNo clouds above just blue in the skiesShoes on my feet I’m ready to runEvery step feels like a loaded gun[Chorus]Happy days are rolling inLet the joy beneath my skinNo more shadows no more liesJust the truth that lifts me high[Verse 2]Dancing through the city streetsA rhythm pounding in my heartbeatStrangers smile it’s catching onThis world’s a stage we’re all a song[Chorus]Happy days are rolling inLet the joy beneath my skinNo more shadows no more liesJust the truth that lifts me high[Bridge]Throw your worries out the doorLet them sink to the ocean floorWe’re alive and it’s enoughLife is messy but it’s love[Chorus]Happy days are rolling inLet the joy beneath my skinNo more shadows no more liesJust the truth that lifts me high

接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

  • lyric:歌词文本
  • custom:填写为 true,代表自定义生成,该参数默认为 false,代表使用 prompt 生成。
  • title:歌曲的标题。
  • style:歌曲的风格,选填。

填写样例如下:

填写完毕之后自动生成了代码如下:

对应的代码:

1
2
3
4
5
6
7
8
9
10
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"model": "FUZZ-1.0",
"action": "generate",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"custom": true
}'

测试允许,生成的效果是类似的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"success": true,
"task_id": "978c2912-6a90-4048-b4c1-43f9cf18c28d",
"trace_id": "08dfbb99-43ce-4f65-8fd1-74b98f2b121a",
"data": [
{
"id": "eac9ab69-e210-490b-9f8d-095a6f074f40",
"title": "VibeRise",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3f3e1354-52ad-4f5b-902c-5f83abd17def/image/eac9ab69-e210-490b-9f8d-095a6f074f40.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3f3e1354-52ad-4f5b-902c-5f83abd17def/audio/eac9ab69-e210-490b-9f8d-095a6f074f40.m4a",
"video_url": null,
"created_at": "2025-06-23T01:57:33.438644Z",
"model": "FUZZ-1.0",
"lyrics_timestamped": {
"words": [
{
"end": 0.64,
"index_range": null,
"line_index": 0,
"start": 0.64,
"text": "[Verse]",
"wav2vec2_format": null
},
{
"end": 0.64,
"index_range": null,
"line_index": 1,
"start": 0.64,
"text": "Woke",
"wav2vec2_format": null
},
...
]
},
"state": "succeeded",
"style": "funk vibes, raspy, raw vocal texture",
"duration": 158.08
},
{
"id": "64fffe1f-b1aa-46dc-8012-b80ba319cf35",
"title": "Pure Dawn",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3f3e1354-52ad-4f5b-902c-5f83abd17def/image/64fffe1f-b1aa-46dc-8012-b80ba319cf35.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3f3e1354-52ad-4f5b-902c-5f83abd17def/audio/64fffe1f-b1aa-46dc-8012-b80ba319cf35.m4a",
"video_url": null,
"created_at": "2025-06-23T01:57:33.963497Z",
"model": "FUZZ-1.0",
"lyrics_timestamped": {
"words": [
{
"end": 0.64,
"index_range": null,
"line_index": 0,
"start": 0.64,
"text": "[Verse]",
"wav2vec2_format": null
},
{
"end": 0.64,
"index_range": null,
"line_index": 1,
"start": 0.64,
"text": "Woke",
"wav2vec2_format": null
},
...
]
},
"state": "succeeded",
"style": "contemporary country",
"duration": 175.36
}
]
}

翻唱歌曲

如果想对已经生成的歌曲进行翻唱操作的操作,可以输入上文生成的歌曲进行翻唱,接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

  • action:此次歌曲任务的行为,目前支持:generate、cover、extend、upload_cover、upload_extend、replace_section、swap_sound、swap_vocals,此次翻唱使用cover参数。
  • lyric:歌词文本
  • title:歌曲的标题。
  • audio_id:歌曲的ID。
  • style:歌曲的风格,选填。

填写样例如下:

填写完毕之后自动生成了代码如下:

对应的代码:

1
2
3
4
5
6
7
8
9
10
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"action": "cover",
"model": "FUZZ-1.0 Pro",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_id": "b7376272-3902-49b4-a83b-62f7e6ab505c"
}'

测试允许,生成的效果是类似的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
"success": true,
"task_id": "fe02997d-f58e-4886-9aa3-4074c9a430eb",
"trace_id": "997bde4c-6063-4fc2-9b03-d837f1efc72d",
"data": [
{
"id": "be254182-d4b7-42b3-9ee2-b86db086cff1",
"title": "Sunny Rise",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/c2f707a9-017d-4354-8bfa-436266dadbf6/image/be254182-d4b7-42b3-9ee2-b86db086cff1.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/c2f707a9-017d-4354-8bfa-436266dadbf6/audio/be254182-d4b7-42b3-9ee2-b86db086cff1.m4a",
"video_url": null,
"created_at": "2025-06-23T01:59:17.666629Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 0.64,
"index_range": null,
"line_index": 0,
"start": 0.64,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 237.44,
"index_range": null,
"line_index": 29,
"start": 236.8,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 239.46235827664398
},
{
"id": "9b9d2810-eb2b-44d3-85c0-cb259afa13c3",
"title": "Uplift",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/c2f707a9-017d-4354-8bfa-436266dadbf6/image/9b9d2810-eb2b-44d3-85c0-cb259afa13c3.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/c2f707a9-017d-4354-8bfa-436266dadbf6/audio/9b9d2810-eb2b-44d3-85c0-cb259afa13c3.m4a",
"video_url": null,
"created_at": "2025-06-23T01:59:23.065712Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 0.64,
"index_range": null,
"line_index": 0,
"start": 0.64,
"text": "[Verse]",
"wav2vec2_format": null
},
...
},
{
"end": 236.16,
"index_range": null,
"line_index": 29,
"start": 225.28,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 239.5299546485261
}
]
}

续写歌曲

如果想续写歌曲的话,我们需要传入action参数值为:extend,接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

  • action:此次歌曲任务的行为,目前支持:generate、cover、extend、upload_cover、upload_extend、replace_section、swap_vocals、swap_sound,此次续写使用extend参数。
  • lyric:歌词文本
  • title:歌曲的标题。
  • audio_id:歌曲的ID。
  • style:歌曲的风格,选填。

填写样例如下:

填写完毕之后自动生成了代码如下:

对应的代码:

1
2
3
4
5
6
7
8
9
10
11
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"action": "extend",
"model": "FUZZ-1.0 Pro",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_id": "b7376272-3902-49b4-a83b-62f7e6ab505c",
"continue_at": 5
}'

测试允许,生成的效果是类似的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"success": true,
"task_id": "6388a0aa-b5ab-4485-baad-f0e0b7a7848c",
"trace_id": "da143dbe-8263-45ac-b05a-1ed57dd4aa79",
"data": [
{
"id": "209e27e0-500c-44f3-9134-280690014920",
"title": "City Rhythm",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3a8378d5-94d4-49b7-9c0a-8432c0c4a39d/image/209e27e0-500c-44f3-9134-280690014920.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3a8378d5-94d4-49b7-9c0a-8432c0c4a39d/audio/209e27e0-500c-44f3-9134-280690014920.m4a",
"video_url": null,
"created_at": "2025-06-23T02:00:53.473604Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 4.48,
"index_range": null,
"line_index": 0,
"start": 4.48,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 179.2,
"index_range": null,
"line_index": 29,
"start": 178.56,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 197.00850340136054
},
{
"id": "ff50012e-ad1b-4b71-8d0e-6a633428a54f",
"title": "Bright",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3a8378d5-94d4-49b7-9c0a-8432c0c4a39d/image/ff50012e-ad1b-4b71-8d0e-6a633428a54f.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/3a8378d5-94d4-49b7-9c0a-8432c0c4a39d/audio/ff50012e-ad1b-4b71-8d0e-6a633428a54f.m4a",
"video_url": null,
"created_at": "2025-06-23T02:00:52.795796Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 0.64,
"index_range": null,
"line_index": 0,
"start": 0.64,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 186.88,
"index_range": null,
"line_index": 29,
"start": 186.24,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 213.85757369614512
}
]
}

替换片段

如果想对歌曲进行替换片段的话,我们需要传入action参数值为:replace_section,接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

  • action:此次歌曲任务的行为,目前支持:generate、cover、extend、upload_cover、upload_extend、replace_section、swap_vocals、swap_sound,此次续写使用extend参数。
  • lyric:需要替换后的歌词文本
  • title:歌曲的标题。
  • audio_id:歌曲的ID。
  • style:歌曲的风格,选填。

填写样例如下:

填写完毕之后自动生成了代码如下:

对应的代码:

1
2
3
4
5
6
7
8
9
10
11
12
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"action": "replace_section",
"model": "FUZZ-1.0 Pro",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_id": "b7376272-3902-49b4-a83b-62f7e6ab505c",
"replace_section_start": 3,
"replace_section_end": 70
}'

测试允许,生成的效果是类似的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"success": true,
"task_id": "73defcbf-f876-4dd6-b60e-4c1c5ecd4565",
"trace_id": "9f639389-7218-4cdb-ade9-b34228bb0f21",
"data": [
{
"id": "037f5e9d-9da4-4d79-b58f-1f433b40d54d",
"title": "Sunrise Joy",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/881ad27f-39c1-4c31-a789-ecc822e13b8c/image/037f5e9d-9da4-4d79-b58f-1f433b40d54d.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/881ad27f-39c1-4c31-a789-ecc822e13b8c/audio/037f5e9d-9da4-4d79-b58f-1f433b40d54d.m4a",
"video_url": null,
"created_at": "2025-06-23T02:18:43.031184Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 3.84,
"index_range": null,
"line_index": 0,
"start": 3.84,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 159.36,
"index_range": null,
"line_index": 29,
"start": 159.36,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 199.2201133786848
},
{
"id": "97638295-068f-4cbc-b076-66f522449bd5",
"title": "Sunrise",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/881ad27f-39c1-4c31-a789-ecc822e13b8c/image/97638295-068f-4cbc-b076-66f522449bd5.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/881ad27f-39c1-4c31-a789-ecc822e13b8c/audio/97638295-068f-4cbc-b076-66f522449bd5.m4a",
"video_url": null,
"created_at": "2025-06-23T02:18:56.267775Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 3.84,
"index_range": null,
"line_index": 0,
"start": 3.84,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 159.36,
"index_range": null,
"line_index": 29,
"start": 159.36,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 199.2201133786848
}
]
}

SwapSound生成

如果想使用官方的SwapSound操作,可以将action参数值设为:swap_sound,接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

  • action:此次歌曲任务的行为,目前支持:generate、cover、extend、upload_cover、upload_extend、swap_sound、swap_vocals。
  • lyric:歌词文本
  • title:歌曲的标题。
  • audio_id:歌曲的ID。
  • style:歌曲的风格,选填。

填写样例如下:

填写完毕之后自动生成了代码如下:

对应的代码:

1
2
3
4
5
6
7
8
9
10
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"action": "swap_sound",
"model": "FUZZ-1.0 Pro",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_id": "b7376272-3902-49b4-a83b-62f7e6ab505c"
}'

测试允许,生成的效果是类似的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"success": true,
"task_id": "93279260-5ca1-42d8-bde1-1fa62e0f5027",
"trace_id": "bc4e28db-4897-4ffc-9e03-45f43da7a21c",
"data": [
{
"id": "242035c0-8ac2-4f0b-a19c-ac2fa49d4df3",
"title": "Brightside",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/36494e8a-eb82-4d89-bbfa-ec719e19572b/image/242035c0-8ac2-4f0b-a19c-ac2fa49d4df3.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/36494e8a-eb82-4d89-bbfa-ec719e19572b/audio/242035c0-8ac2-4f0b-a19c-ac2fa49d4df3.m4a",
"video_url": null,
"created_at": "2025-06-23T02:02:32.799561Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 1.28,
"index_range": null,
"line_index": 0,
"start": 1.28,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 195.84,
"index_range": null,
"line_index": 29,
"start": 195.84,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 197.2696371882086
},
{
"id": "594fe702-6c71-4b0c-abb6-21b58efc74a6",
"title": "Sunrise",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/36494e8a-eb82-4d89-bbfa-ec719e19572b/image/594fe702-6c71-4b0c-abb6-21b58efc74a6.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/36494e8a-eb82-4d89-bbfa-ec719e19572b/audio/594fe702-6c71-4b0c-abb6-21b58efc74a6.m4a",
"video_url": null,
"created_at": "2025-06-23T02:02:30.523279Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 0.64,
"index_range": null,
"line_index": 0,
"start": 0.64,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 192.64,
"index_range": null,
"line_index": 29,
"start": 192.64,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 196.7198866213152
}
]
}

SwapVocals 生成

如果想使用官方的SwapVocals操作,可以将action参数值设为:swap_vocals,接下来我们要根据歌词、标题、风格自定义生成歌曲,就可以指定如下内容:

  • action:此次歌曲任务的行为,目前支持:generate、cover、extend、upload_cover、upload_extend、swap_sound、swap_vocals。
  • lyric:歌词文本
  • title:歌曲的标题。
  • audio_id:歌曲的ID。
  • style:歌曲的风格,选填。

填写样例如下:

填写完毕之后自动生成了代码如下:

对应的代码:

1
2
3
4
5
6
7
8
9
10
curl -X POST 'https://api.acedata.cloud/riffusion/audios' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"action": "swap_vocals",
"model": "FUZZ-1.0 Pro",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_id": "b7376272-3902-49b4-a83b-62f7e6ab505c"
}'

测试允许,生成的效果是类似的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"success": true,
"task_id": "a6e0d456-189b-4c78-9232-2fe72166ab39",
"trace_id": "ee5769d4-ae94-4e5a-a85f-b3c0ddc2e48e",
"data": [
{
"id": "b8b1ed14-f43c-4738-a697-60ba24b6049d",
"title": "Uplift",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/25ce4ddd-e48c-42e2-9ea3-8e03380508f2/image/b8b1ed14-f43c-4738-a697-60ba24b6049d.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/25ce4ddd-e48c-42e2-9ea3-8e03380508f2/audio/b8b1ed14-f43c-4738-a697-60ba24b6049d.m4a",
"video_url": null,
"created_at": "2025-06-23T02:04:18.477032Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 2.56,
"index_range": null,
"line_index": 0,
"start": 2.56,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 186.88,
"index_range": null,
"line_index": 29,
"start": 171.52,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 195.55968253968254
},
{
"id": "dfd6eb9c-a1f3-4e1f-bbf9-e0b9625e459f",
"title": "Vivid Rise",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/25ce4ddd-e48c-42e2-9ea3-8e03380508f2/image/dfd6eb9c-a1f3-4e1f-bbf9-e0b9625e459f.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/25ce4ddd-e48c-42e2-9ea3-8e03380508f2/audio/dfd6eb9c-a1f3-4e1f-bbf9-e0b9625e459f.m4a",
"video_url": null,
"created_at": "2025-06-23T02:04:27.140387Z",
"model": null,
"lyrics_timestamped": {
"words": [
{
"end": 1.28,
"index_range": null,
"line_index": 0,
"start": 1.28,
"text": "[Verse]",
"wav2vec2_format": null
},
...
{
"end": 188.8,
"index_range": null,
"line_index": 29,
"start": 188.16,
"text": "high",
"wav2vec2_format": null
}
]
},
"state": "succeeded",
"style": "",
"duration": 196.07185941043085
}
]
}

异步回调

由于 Riffusion Audios Generation API 生成的时间有时候会相对较长,如果 API 长时间无响应,HTTP 请求会一直保持连接,导致额外的系统资源消耗,所以本 API 也提供了异步回调的支持。

整体流程是:客户端发起请求的时候,额外指定一个 callback_url 字段,客户端发起 API 请求之后,API 会立马返回一个结果,包含一个 task_id 的字段信息,代表当前的任务 ID。当任务完成之后,生成任务的结果会通过 POST JSON 的形式发送到客户端指定的 callback_url,其中也包括了 task_id 字段,这样任务结果就可以通过 ID 关联起来了。

下面我们通过示例来了解下具体怎样操作。

首先,Webhook 回调是一个可以接收 HTTP 请求的服务,开发者应该替换为自己搭建的 HTTP 服务器的 URL。此处为了方便演示,使用一个公开的 Webhook 样例网站 https://webhook.site/,打开该网站即可得到一个 Webhook URL,如图所示:

将此 URL 复制下来,就可以作为 Webhook 来使用,此处的样例为 https://webhook.site/68368fc6-7f0a-425e-b63a-cc48631615fe

接下来,我们可以设置字段 callback_url 为上述 Webhook URL,同时填入相应的参数,具体的内容如图所示:

点击运行,可以发现会立即得到一个结果,如下:

1
2
3
{
"task_id": "9939767a-7f9c-4f43-aabf-ca68fe385f3c"
}

稍等片刻,我们可以在 https://webhook.site/68368fc6-7f0a-425e-b63a-cc48631615fe 上观察到生成任务的结果,如图所示:

内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"success": true,
"task_id": "9939767a-7f9c-4f43-aabf-ca68fe385f3c",
"trace_id": "13a86870-e705-45d0-8447-82a08701c0fa",
"data": [
{
"id": "72e6c476-0116-4da9-ae34-f78190020b35",
"title": "Rise",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/9b9f3281-6b47-44ac-8e4b-3b0d105e163d/image/72e6c476-0116-4da9-ae34-f78190020b35.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/9b9f3281-6b47-44ac-8e4b-3b0d105e163d/audio/72e6c476-0116-4da9-ae34-f78190020b35.m4a",
"video_url": null,
"created_at": "2025-06-15T15:43:22.432605Z",
"model": "FUZZ-1.0",
"state": "succeeded",
"style": "acoustic folk, finger picking",
"duration": 184.96
},
{
"id": "7f4f5c20-4395-4583-9dbb-735b9bb86957",
"title": "Luminance",
"image_url": "https://storage.googleapis.com/corpusant-app-public/riffs/9b9f3281-6b47-44ac-8e4b-3b0d105e163d/image/7f4f5c20-4395-4583-9dbb-735b9bb86957.jpg",
"lyric": "[Verse]\nWoke up with the sun in my eyes\nNo clouds above just blue in the skies\nShoes on my feet I’m ready to run\nEvery step feels like a loaded gun\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Verse 2]\nDancing through the city streets\nA rhythm pounding in my heartbeat\nStrangers smile it’s catching on\nThis world’s a stage we’re all a song\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high\n[Bridge]\nThrow your worries out the door\nLet them sink to the ocean floor\nWe’re alive and it’s enough\nLife is messy but it’s love\n[Chorus]\nHappy days are rolling in\nLet the joy beneath my skin\nNo more shadows no more lies\nJust the truth that lifts me high",
"audio_url": "https://storage.googleapis.com/corpusant-app-public/riffs/9b9f3281-6b47-44ac-8e4b-3b0d105e163d/audio/7f4f5c20-4395-4583-9dbb-735b9bb86957.m4a",
"video_url": null,
"created_at": "2025-06-15T15:43:21.574561Z",
"model": "FUZZ-1.0",
"state": "succeeded",
"style": "deep bass, ethereal electronic",
"duration": 165.12
}
]
}

可以看到结果中有一个 task_id 字段,其他的字段都和上文类似,通过该字段即可实现任务的关联。

错误处理

在调用 API 时,如果遇到错误,API 会返回相应的错误代码和信息。例如:

  • 400 token_mismatched:Bad request, possibly due to missing or invalid parameters.
  • 400 api_not_implemented:Bad request, possibly due to missing or invalid parameters.
  • 401 invalid_token:Unauthorized, invalid or missing authorization token.
  • 429 too_many_requests:Too many requests, you have exceeded the rate limit.
  • 500 api_error:Internal server error, something went wrong on the server.

错误响应示例

1
2
3
4
5
6
7
8
{
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}

结论

通过本文档,您已经了解了如何使用 Riffusion Audios Generation API 可通过输入提示词来生成音乐。希望本文档能帮助您更好地对接和使用该 API。如有任何问题,请随时联系我们的技术支持团队。