创建歌词
curl --request POST \
--url https://api.senseaudio.cn/v1/music/lyrics/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "senseaudio-music-2.0-260626",
"prompt": "<string>",
"style": "<string>",
"rhyme": "<string>",
"enhance_theme": true,
"language": "zh",
"expect_duration": 305,
"additional_prompt": "<string>"
}
'import requests
url = "https://api.senseaudio.cn/v1/music/lyrics/create"
payload = {
"model": "senseaudio-music-2.0-260626",
"prompt": "<string>",
"style": "<string>",
"rhyme": "<string>",
"enhance_theme": True,
"language": "zh",
"expect_duration": 305,
"additional_prompt": "<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({
model: 'senseaudio-music-2.0-260626',
prompt: '<string>',
style: '<string>',
rhyme: '<string>',
enhance_theme: true,
language: 'zh',
expect_duration: 305,
additional_prompt: '<string>'
})
};
fetch('https://api.senseaudio.cn/v1/music/lyrics/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/lyrics/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([
'model' => 'senseaudio-music-2.0-260626',
'prompt' => '<string>',
'style' => '<string>',
'rhyme' => '<string>',
'enhance_theme' => true,
'language' => 'zh',
'expect_duration' => 305,
'additional_prompt' => '<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/lyrics/create"
payload := strings.NewReader("{\n \"model\": \"senseaudio-music-2.0-260626\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"rhyme\": \"<string>\",\n \"enhance_theme\": true,\n \"language\": \"zh\",\n \"expect_duration\": 305,\n \"additional_prompt\": \"<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/lyrics/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"senseaudio-music-2.0-260626\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"rhyme\": \"<string>\",\n \"enhance_theme\": true,\n \"language\": \"zh\",\n \"expect_duration\": 305,\n \"additional_prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.senseaudio.cn/v1/music/lyrics/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 \"model\": \"senseaudio-music-2.0-260626\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"rhyme\": \"<string>\",\n \"enhance_theme\": true,\n \"language\": \"zh\",\n \"expect_duration\": 305,\n \"additional_prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"data": [
{
"text": "<string>",
"title": "<string>",
"caption": "<string>",
"bpm": 123,
"key_scale": "<string>",
"time_signature": "<string>",
"duration": 123,
"vocal_language": "<string>"
}
]
}音乐生成
歌词生成
根据主题和风格同步生成结构化歌词
POST
/
v1
/
music
/
lyrics
/
create
创建歌词
curl --request POST \
--url https://api.senseaudio.cn/v1/music/lyrics/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "senseaudio-music-2.0-260626",
"prompt": "<string>",
"style": "<string>",
"rhyme": "<string>",
"enhance_theme": true,
"language": "zh",
"expect_duration": 305,
"additional_prompt": "<string>"
}
'import requests
url = "https://api.senseaudio.cn/v1/music/lyrics/create"
payload = {
"model": "senseaudio-music-2.0-260626",
"prompt": "<string>",
"style": "<string>",
"rhyme": "<string>",
"enhance_theme": True,
"language": "zh",
"expect_duration": 305,
"additional_prompt": "<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({
model: 'senseaudio-music-2.0-260626',
prompt: '<string>',
style: '<string>',
rhyme: '<string>',
enhance_theme: true,
language: 'zh',
expect_duration: 305,
additional_prompt: '<string>'
})
};
fetch('https://api.senseaudio.cn/v1/music/lyrics/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/lyrics/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([
'model' => 'senseaudio-music-2.0-260626',
'prompt' => '<string>',
'style' => '<string>',
'rhyme' => '<string>',
'enhance_theme' => true,
'language' => 'zh',
'expect_duration' => 305,
'additional_prompt' => '<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/lyrics/create"
payload := strings.NewReader("{\n \"model\": \"senseaudio-music-2.0-260626\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"rhyme\": \"<string>\",\n \"enhance_theme\": true,\n \"language\": \"zh\",\n \"expect_duration\": 305,\n \"additional_prompt\": \"<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/lyrics/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"senseaudio-music-2.0-260626\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"rhyme\": \"<string>\",\n \"enhance_theme\": true,\n \"language\": \"zh\",\n \"expect_duration\": 305,\n \"additional_prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.senseaudio.cn/v1/music/lyrics/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 \"model\": \"senseaudio-music-2.0-260626\",\n \"prompt\": \"<string>\",\n \"style\": \"<string>\",\n \"rhyme\": \"<string>\",\n \"enhance_theme\": true,\n \"language\": \"zh\",\n \"expect_duration\": 305,\n \"additional_prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"data": [
{
"text": "<string>",
"title": "<string>",
"caption": "<string>",
"bpm": 123,
"key_scale": "<string>",
"time_signature": "<string>",
"duration": 123,
"vocal_language": "<string>"
}
]
}说明
根据主题和风格同步生成结构化歌词,并返回标题、编曲信息与歌词正文。该接口为同步接口,请求完成后直接返回歌词结果,不需要轮询任务状态。
授权
格式:Bearer <API_KEY>
请求体
application/json
已启用且支持歌词生成的音乐模型 label。
可用选项:
senseaudio-music-2.0-260626 歌曲主题或歌词描述,不可为空。
音乐或写作风格。
期望使用的韵脚。
是否自动增强并扩写主题。
歌词语言,使用 ISO 639-1 代码。
期望歌曲时长,单位秒。
必填范围:
10 <= x <= 600附加生成要求。
⌘I