跳转到主要内容
POST
/
v1
/
music
/
song
/
create
创建音乐
curl --request POST \
  --url https://api.senseaudio.cn/v1/music/song/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "lyrics": "<string>",
  "model": "senseaudio-music-1.0-260319",
  "custom_mode": true,
  "instrumental": true,
  "negative_tags": "<string>",
  "style": "<string>",
  "style_weight": 123,
  "title": "<string>",
  "vocal_gender": "<string>"
}
'
import requests

url = "https://api.senseaudio.cn/v1/music/song/create"

payload = {
"lyrics": "<string>",
"model": "senseaudio-music-1.0-260319",
"custom_mode": True,
"instrumental": True,
"negative_tags": "<string>",
"style": "<string>",
"style_weight": 123,
"title": "<string>",
"vocal_gender": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lyrics: '<string>',
model: 'senseaudio-music-1.0-260319',
custom_mode: true,
instrumental: true,
negative_tags: '<string>',
style: '<string>',
style_weight: 123,
title: '<string>',
vocal_gender: '<string>'
})
};

fetch('https://api.senseaudio.cn/v1/music/song/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.senseaudio.cn/v1/music/song/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'lyrics' => '<string>',
'model' => 'senseaudio-music-1.0-260319',
'custom_mode' => true,
'instrumental' => true,
'negative_tags' => '<string>',
'style' => '<string>',
'style_weight' => 123,
'title' => '<string>',
'vocal_gender' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.senseaudio.cn/v1/music/song/create"

payload := strings.NewReader("{\n \"lyrics\": \"<string>\",\n \"model\": \"senseaudio-music-1.0-260319\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"negative_tags\": \"<string>\",\n \"style\": \"<string>\",\n \"style_weight\": 123,\n \"title\": \"<string>\",\n \"vocal_gender\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.senseaudio.cn/v1/music/song/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lyrics\": \"<string>\",\n \"model\": \"senseaudio-music-1.0-260319\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"negative_tags\": \"<string>\",\n \"style\": \"<string>\",\n \"style_weight\": 123,\n \"title\": \"<string>\",\n \"vocal_gender\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.senseaudio.cn/v1/music/song/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lyrics\": \"<string>\",\n \"model\": \"senseaudio-music-1.0-260319\",\n \"custom_mode\": true,\n \"instrumental\": true,\n \"negative_tags\": \"<string>\",\n \"style\": \"<string>\",\n \"style_weight\": 123,\n \"title\": \"<string>\",\n \"vocal_gender\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "task_id": "<string>"
}

说明

请求生成歌曲,获得异步任务ID。获得异步任务ID后可使用查询歌曲任务 API轮询歌曲生成状态。

歌曲格式

当参数 custom_modefalse 时,歌词需要按照指定格式输入。歌词由多个歌曲段组成,每个段以结构标签开头。模型通过这些标签引导歌曲结构和歌词发展。
标签段落类型是否需要歌词时长参考说明
[intro-short]前奏 Intro❌ 无歌词~0–10 秒短前奏,纯伴奏引入
[intro-medium]前奏 Intro❌ 无歌词~10–20 秒中长前奏版本
[inst-short]纯伴奏段❌ 无歌词~0–10 秒中间的器乐演奏段
[inst-medium]纯伴奏段❌ 无歌词~10–20 秒较长的器乐段
[outro-short]尾奏 Outro❌ 无歌词~0–10 秒短尾部收束
[outro-medium]尾奏 Outro❌ 无歌词~10–20 秒中长尾部收束
[verse]主歌 Verse✅ 需要歌词无固定时长承担叙事内容,应有完整句子
[chorus]副歌 Chorus✅ 需要歌词无固定时长歌曲主题部分,应朗朗上口
[bridge]过渡 Bridge✅ 需要歌词无固定时长连接主歌与副歌,增强情绪转换

授权

Authorization
string
header
必填

格式:Bearer <API_KEY>

请求体

application/json
lyrics
string
必填

歌词或提示词,传入歌词时需要按照上文中的格式输入,提示词则无限制,不能超过 2000 码位

model
enum<string>
必填

模型,目前只能使用senseaudio-music-1.0-260319

可用选项:
senseaudio-music-1.0-260319
custom_mode
boolean

是否自定义模式,即是否传入提示词而不是歌词

instrumental
boolean

是否纯音乐,纯音乐仍然需要传入歌词或提示词

negative_tags
string

负面标签,排除的风格元素

style
string

歌曲风格

style_weight
number

风格权重 0-1

title
string

歌曲标题

vocal_gender
string

歌曲中人声的性别,f代表女性,m代表男性

响应

200 - application/json

成功

task_id
string

任务ID