MAPI
音频(Audio)Suno

样本转歌曲

以样本为基础生成歌曲。源必须来自 suno-upload,用 task_id + audio_index(1-based,默认 1)引用音轨。普通生成任务不能作源。

start_s、end_s 必填,须满足 0 ≤ start_s < end_s,不会自动补成 0 或 60。

custom 决定哪些字段生效。已提交字段无论当前模式是否生效,都须满足类型、范围和长度。不传 custom 时按此推断:有 prompt → true;无 prompt 但有 gpt_description → false;否则有 tags 或 title → true。

  • custom=true 时 prompt、title、tags、negative_tags、auto_lyrics、style_weight、weirdness、audio_weight 生效,gpt_description 被忽略。custom=true 且 instrumental=false 时 prompt 必填。
  • custom=false 时只读 gpt_description(必填,缺失提交期 400、不扣费)。vocal_gender 两种模式都生效。
  • version:v6 / v6-wild / v6-mini,省略默认 v6。使用 custom_model_id 时省略。custom_model_id 与 version 互斥。
  • 不支持目标时长,也不支持 persona_id。max_mode 启用要求自定义模式,按普通售价的 2 倍计费。创意度用 weirdness,兼容旧名 weirdness_constraint。
  • 提交接口:POST /v1/music/generations,model: "suno-sample"。
  • 任务查询:GET /v1/music/generations/{task_id}。
POST
/v1/music/generations

Authorization

BearerAuth

AuthorizationBearer <token>

使用 MAPI Bearer Token 认证。格式:Authorization: Bearer sk-xxxxxx。

In: header

Request Body

application/json

model*string

固定填写 suno-sample。

task_id*string

suno-upload 上传任务的 ID,必填。缺失、不是上传任务或无法解析源时提交期直接返回 400。

audio_index?integer

源任务结果 music[] 中的第几首(1-based,默认 1;一次生成通常 2 首:索引 1 与 2)。

Default1
Range1 <= value
start_s*number

采样起点(秒),必填。缺失直接返回 400。须满足 0 ≤ start_s < end_s。不会自动补成 0。

Range0 <= value
end_s*number

采样终点(秒),必填。必须满足 0 ≤ start_s < end_s;源时长已知时不能越界。不会自动补成 60。

instrumental?boolean

是否纯器乐。true 表示无人声;省略默认 false(要人声)。

Defaultfalse
version?string

公共版本:v6 / v6-wild / v6-mini。省略默认 v6。使用 custom_model_id 时省略。

Default"v6"
Value in"v6" | "v6-wild" | "v6-mini"
custom_model_id?string

创建模型任务返回的完整 UUID,与 version 互斥。

custom?boolean

true 为自定义模式,prompt 作歌词;false 为灵感模式,用 gpt_description。省略时按内容推断:有 prompt → true;无 prompt 但有 gpt_description → false;否则有 tags 或 title → true。

prompt?string

歌词。custom=true 且 instrumental=false 时必填。灵感模式下不生效,但已提交值仍须满足长度要求。

gpt_description?string

灵感提示词。custom=false 时必填,缺失提交期直接返回 400、不扣费。custom=true 时被忽略。

title?string

标题。仅 custom=true 时生效。

tags?string

风格标签。仅 custom=true 时生效。

negative_tags?string

要排除的风格标签。仅 custom=true 时生效。

auto_lyrics?boolean

是否对输入歌词进行二次创作。仅 custom=true 时生效。

style_weight?number

风格权重,范围 0.00–1.00。越界提交期直接返回 400。仅 custom=true 时生效。

Range0 <= value <= 1
weirdness?number

创意权重,范围 0.00–1.00。兼容旧名 weirdness_constraint;新请求请使用 weirdness。

Range0 <= value <= 1
audio_weight?number

音频权重,范围 0.00–1.00。仅 custom=true 时生效。

Range0 <= value <= 1
vocal_gender?string

人声性别:Male / Female。两种模式都生效。

Value in"Male" | "Female"
variety?string

风格变化程度:off / normal / high / extra / max。可省略。

Value in"off" | "normal" | "high" | "extra" | "max"
max_mode?boolean

是否启用 Max 模式。启用时要求自定义模式,并按普通售价的 2 倍计费。

Defaultfalse
audio_format?string

输出音频格式:mp3 / m4a / wav。本接口不支持目标时长字段。

Value in"mp3" | "m4a" | "wav"

Response Body

application/json

application/json

curl -X POST "https://loading/v1/music/generations" \  -H "Content-Type: application/json" \  -d '{    "model": "suno-sample",    "task_id": "task_01ABC",    "audio_index": 1,    "start_s": 0,    "end_s": 8,    "instrumental": false,    "prompt": "沿着夜色继续歌唱",    "version": "v6",    "tags": "upbeat pop"  }'
{
  "code": 200,
  "message": "success",
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
    }
  ]
}
{
  "code": "invalid_request",
  "message": "start_s is required",
  "data": null
}

最后更新于