curl --request POST \
--url https://api.apimart.ai/v1/music/generations/createModel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "suno",
"name": "温暖民谣模型",
"audio_urls": [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3"
]
}'
import requests
response = requests.post(
"https://api.apimart.ai/v1/music/generations/createModel",
headers={"Authorization": "Bearer <token>"},
json={
"model": "suno",
"name": "温暖民谣模型",
"audio_urls": [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3",
],
},
)
print(response.json())
const response = await fetch("https://api.apimart.ai/v1/music/generations/createModel", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "suno",
name: "温暖民谣模型",
audio_urls: [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3"
]
})
});
console.log(await response.json());
{
"code": 200,
"data": [
{"status": "submitted", "task_id": "task_01M24YMN4EV04M84R5QYM77R1E"}
]
}
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "completed",
"progress": 100,
"result": {
"model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "温暖民谣模型"
}
}
}
Suno
创建自定义模型
使用 6–24 条参考音频创建可用于 Suno V6 生成的自定义模型
POST
/
v1
/
music
/
generations
/
createModel
curl --request POST \
--url https://api.apimart.ai/v1/music/generations/createModel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "suno",
"name": "温暖民谣模型",
"audio_urls": [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3"
]
}'
import requests
response = requests.post(
"https://api.apimart.ai/v1/music/generations/createModel",
headers={"Authorization": "Bearer <token>"},
json={
"model": "suno",
"name": "温暖民谣模型",
"audio_urls": [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3",
],
},
)
print(response.json())
const response = await fetch("https://api.apimart.ai/v1/music/generations/createModel", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "suno",
name: "温暖民谣模型",
audio_urls: [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3"
]
})
});
console.log(await response.json());
{
"code": 200,
"data": [
{"status": "submitted", "task_id": "task_01M24YMN4EV04M84R5QYM77R1E"}
]
}
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "completed",
"progress": 100,
"result": {
"model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "温暖民谣模型"
}
}
}
创建模型是异步任务。提交后先取得训练
task_id,轮询任务完成后再从 data.result.model_id 读取自定义模型 ID。curl --request POST \
--url https://api.apimart.ai/v1/music/generations/createModel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "suno",
"name": "温暖民谣模型",
"audio_urls": [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3"
]
}'
import requests
response = requests.post(
"https://api.apimart.ai/v1/music/generations/createModel",
headers={"Authorization": "Bearer <token>"},
json={
"model": "suno",
"name": "温暖民谣模型",
"audio_urls": [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3",
],
},
)
print(response.json())
const response = await fetch("https://api.apimart.ai/v1/music/generations/createModel", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "suno",
name: "温暖民谣模型",
audio_urls: [
"https://example.com/ref-01.mp3",
"https://example.com/ref-02.mp3",
"https://example.com/ref-03.wav",
"https://example.com/ref-04.m4a",
"https://example.com/ref-05.mp3",
"https://example.com/ref-06.mp3"
]
})
});
console.log(await response.json());
Authorizations
string
必填
Bearer Token。访问 API Key 管理页面 获取 API Key。
Body
string
默认值:"suno"
固定使用
suno。string
必填
自定义模型名称。去掉首尾空白后不能为空。
string[]
必填
6–24 条公网可访问的 HTTP(S) 音频直链,建议使用 MP3、WAV 或 M4A。每条 URL 都应直接返回音频文件,不能是需要登录的网页。
无效素材可能导致整个创建任务失败。本地文件请先使用项目的上传能力获得公网 URL;不要传本地路径或
blob: URL。Response
integer
响应状态码。
array
提交结果。读取
data[0].task_id,再通过 GET /v1/music/tasks/{task_id} 查询训练状态。{
"code": 200,
"data": [
{"status": "submitted", "task_id": "task_01M24YMN4EV04M84R5QYM77R1E"}
]
}
{
"code": 200,
"data": {
"id": "task_01M24YMN4EV04M84R5QYM77R1E",
"status": "completed",
"progress": 100,
"result": {
"model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "温暖民谣模型"
}
}
}
使用创建的模型
完成后保存result.model_id,后续在支持自定义模型的操作中作为 custom_model_id 使用,并省略 version 和 persona_id:
{
"model": "suno",
"custom_model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"custom": true,
"instrumental": false,
"prompt": "[Verse]\n旧木吉他弹起新的旅程",
"style": "acoustic folk, warm vocals",
"max_mode": true,
"audio_format": "mp3"
}