跳到导航

Suno v6

以 Markdown 格式查看

音乐 API 上的 Suno v6:POST https://api.beatapi.io/v1/audios/tasks。先写一首歌,再用产出它的任务号续写、翻唱、分轨或转成 WAV。一次调用返回一到两首歌,固定一个价,与歌曲长度无关。

Beta 说明。 Suno 通过第三方线路提供,排队可能比平时久;失败的任务不扣费。

型号

型号说明
suno-v6默认推荐型号:人声更自然,细节更丰富。
suno-v6-mini轻量快速,兼顾质量与速度;duration 对它不生效。
suno-v6-wild风格更大胆,更有辨识度。

三个型号共用同一份请求合同和同一张价目表,用 model 选择;下文对每个型号都适用。关于 duration:suno-v6 建议 60 秒以上(目标短于 60 秒时通常仍会生成约 60 秒),suno-v6-wild 大体遵循,suno-v6-mini 不生效。

简单模式与自定义模式

custom_mode 决定歌曲有多少内容由你自己写,不传时为 false。

简单模式(custom_mode 为 false)自定义模式(custom_mode 为 true)
prompt必填。对歌曲的描述,最多 3,000 个字符。歌词,最多 5,000 个字符。instrumental 为 true 时可省略,否则必填。
style、title不接受。两者必填。style 最多 1,000 个字符,title 最多 80 个。
instrumental可选。可选;true 表示纯音乐,没有人声和歌词。
negative_tags、vocal_gender(m 或 f)不接受。可选。negative_tags 写需要避开的风格。
style_weight、weirdness_constraint、audio_weight(0–1)、variety(0–4)不接受。可选。audio_weight 调的是人声权重,所以不能与 instrumental: true 同时传。
persona_id、persona_model(style_persona 或 voice_persona)不接受。可选;传 persona_model 时必须同时传 persona_id。
duration(10–360 秒)不接受。可选的目标长度,不影响价格。
{
"model": "suno-v6",
"custom_mode": true,
"title": "Driving Home",
"style": "warm acoustic folk, male vocal, fingerpicked guitar",
"prompt": "[Verse]\nThe road is gold and the dashboard hums\n[Chorus]\nI am driving home",
"vocal_gender": "m",
"negative_tags": "heavy metal, screaming"
}

操作不读取的字段会被 400 bad_request 拒绝,而不是悄悄忽略,这样不会为一首不是你想要的歌扣费。

操作一览

action 选择操作,默认 generate。每个操作只接受自己的字段;多传字段会返回 400 bad_request,信息里写明是哪个字段(style is not used by action lyrics; leave it out)。价格单位为美元每次调用。

action用途必填可选单价
generate根据提示词生成新歌。prompt(自定义模式再加 style、title)custom_mode、instrumental,以及上文自定义模式的字段$0.10
extend续写一首歌。音源:source_task_id(+ audio_id)或 audio_urlprompt、style、title、continue_at(秒,0–480)、instrumental、negative_tags、vocal_gender、各权重和 variety、persona_id、persona_model$0.10
cover用新风格翻唱一首歌。音源:source_task_id(+ audio_id)或 audio_urlprompt、style、title、instrumental、duration、歌曲控制项、persona_id、persona_model$0.10
add_vocals给纯音乐加人声。audio_url、style、title、negative_tagsprompt 和歌曲控制项$0.10
add_instrumental给人声加伴奏。audio_url、style、title、negative_tagsprompt 和歌曲控制项$0.10
replace_section重写自己歌曲中的一段。source_task_id(+ audio_id)、prompt、style、title、section_start、section_end(秒,结束须晚于开始)、full_lyricslyrics、歌曲控制项、persona_id、persona_model$0.042
mashup把两首歌混搭成一首。audio_urls(恰好两个)、style、titleprompt、duration、歌曲控制项、persona_id、persona_model$0.10
sounds音效或循环片段。promptsound_loop、sound_tempo(1–300)、sound_key、grab_lyrics$0.021
speech口播。简单模式按描述生成;custom_mode: true 时朗读你写的 script。prompt(简单模式)或 script(自定义模式,此时不接受 prompt)custom_mode;自定义模式下还有 tone、variety、vocal_gender、background_music$0.10
lyrics只写歌词。prompt无$0.0033
boost_style把简短的风格描述扩写丰富。style无$0.0033
timestamped_lyrics与音频对齐的逐句时间轴歌词。source_task_id(+ audio_id)无$0.0042
separate把歌曲拆成分轨。音源:source_task_id(+ audio_id)或 audio_urlseparation_type、stem_name见下表
convert_wav取得自己歌曲的 WAV 文件。source_task_id(+ audio_id)无$0.0033
midi(测试版)取得自己歌曲的 MIDI 音符。source_task_id(+ audio_id)无免费
music_video为自己的歌曲生成音乐视频。source_task_id(+ audio_id)author、domain_name$0.017
cover_image为已完成的任务生成封面图。source_task_id无免费
persona把一种声音或风格存成可复用的人设。source_task_id(+ audio_id)、name、descriptionvocal_start、vocal_end(秒,结束须晚于开始)、style免费

「歌曲控制项」指 negative_tags、vocal_gender、style_weight、weirdness_constraint、audio_weight 和 variety。

separate 按 separation_type 计价,缺省为 separate_vocal:

separation_type结果单价
separate_vocal(默认)两轨:人声和伴奏。$0.084
split_stem十二条分轨。$0.42
split_stem_advanced单独一条指定分轨;必须传 stem_name(例如 Lead Vocal、Drum Kit、Bass、Piano),搭配其他 separation_type 时传 stem_name 会被拒绝。$0.17

midi 是测试版功能:音符放在 output.data 里,格式后续可能调整。

失败的任务不计费。创建请求的返回和 GET /v1/tasks/{id} 里的 usage 字段与其他任务相同。

对自己的歌继续操作

后续操作用 source_task_id 写明产出这首歌的任务;任务产出了两首歌时,再用 audio_id 指明是哪一首。audio_id 取自 output.tracks[].id,不传则取第一首。source_task_id 必须是你自己的任务,否则返回 400 bad_request(source_task_id does not name a task of yours)。不能只传 audio_id 而不传 source_task_id。

extend、cover 和 separate 也可以改用公网 HTTPS 的 audio_url,处理不是在这里生成的音频。两者只能传一个,不能都传。add_vocals、add_instrumental 和 mashup 只接受链接。

先生成,再读取歌曲:

curl https://api.beatapi.io/v1/tasks/task_9Fh2Lq \
-H "Authorization: Bearer $BEATAPI_API_KEY"

从完成的任务里取 output.tracks[0].id(见下文「任务结果」),再接着它操作。

从第 60 秒起续写:

{
"model": "suno-v6",
"action": "extend",
"source_task_id": "task_9Fh2Lq",
"audio_id": "6b0f8f4e-2c1a-4f52-9a53-1d8d3f0c7a11",
"continue_at": 60,
"prompt": "A quiet bridge, then a final chorus"
}

把同一首歌转成 WAV:

{
"model": "suno-v6",
"action": "convert_wav",
"source_task_id": "task_9Fh2Lq",
"audio_id": "6b0f8f4e-2c1a-4f52-9a53-1d8d3f0c7a11"
}

拆成人声和伴奏:

{
"model": "suno-v6",
"action": "separate",
"source_task_id": "task_9Fh2Lq",
"audio_id": "6b0f8f4e-2c1a-4f52-9a53-1d8d3f0c7a11",
"separation_type": "separate_vocal"
}

每一次都是一个新任务,有自己的 id、价格和结果。后续操作与它所基于的任务走同一条路由。如果那条路由已下线,调用会返回 400 bad_request,信息为 the task this request builds on can no longer be worked on; create it again,这时请重新生成这首歌。只返回了一个音频文件的歌曲没有可单独操作的分轨:extend、cover 和 separate 在文件仍可用时还能基于它继续,其他后续操作会返回说明可用操作的 400。超过六天的文件会被拒绝,信息为 the song of source_task_id has expired,请改用 audio_url 传入文件,或重新生成。

错误

信息处理方式
"prompt" is required: describe the song简单模式必须传 prompt。
style is read only in custom mode; send custom_mode true with it传 custom_mode: true,或去掉该字段。
"style" is required in custom mode自定义模式必须同时传 style 和 title。
"prompt" carries the lyrics in custom mode and is required unless instrumental is true传入歌词,或设置 instrumental: true。
"prompt" is at most 3000 characters in simple mode; use custom mode to send full lyrics歌词较长时改用自定义模式。
style is not used by action lyrics; leave it out该操作不读取这个字段。
"source_task_id" is required for action midi: the id of your own task that made the track写明产出这首歌的任务。
action extend takes either source_task_id (one of your tracks) or audio_url, not both and not neither音源只传一种。
"stem_name" is required with separation_type split_stem_advanced写明分轨名称。
"section_end" must be after "section_start"修正段落的起止时间。

任务本身失败时,错误码与其他任务的错误码一致,失败任务会退款。

价目表

三个型号价格相同,单位为美元每次调用。30 秒的歌和 4 分钟的歌价格一样。

操作单价
generate、extend、cover、add_vocals、add_instrumental、mashup、speech$0.10
replace_section$0.042
sounds$0.021
music_video$0.017
timestamped_lyrics$0.0042
lyrics、boost_style、convert_wav$0.0033
separate,separate_vocal / split_stem / split_stem_advanced0.084/0.084 / 0.42 / $0.17
persona、midi、cover_image免费

价目列表 GET /v1/pricing 每个操作一行。