音乐生成
curl --request POST \
--url https://api.mountsea.ai/eleven/music \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "music_v1",
"prompt": "A melancholic indie folk song with acoustic guitar and soft vocals",
"compositionPlan": {
"positive_global_styles": [
"epic orchestral",
"cinematic"
],
"negative_global_styles": [
"lo-fi",
"acoustic"
],
"sections": [
{
"section_name": "Verse",
"positive_local_styles": [
"soft piano",
"building tension"
],
"negative_local_styles": [
"heavy drums"
],
"duration_ms": 15000,
"lines": [
"First line of lyrics",
"Second line"
]
}
]
},
"musicLengthMs": 180000,
"seed": 877369,
"forceInstrumental": false,
"respectSectionsDurations": true,
"outputFormat": "mp3_44100_128",
"storeForInpainting": false,
"signWithC2pa": false
}
'import requests
url = "https://api.mountsea.ai/eleven/music"
payload = {
"model": "music_v1",
"prompt": "A melancholic indie folk song with acoustic guitar and soft vocals",
"compositionPlan": {
"positive_global_styles": ["epic orchestral", "cinematic"],
"negative_global_styles": ["lo-fi", "acoustic"],
"sections": [
{
"section_name": "Verse",
"positive_local_styles": ["soft piano", "building tension"],
"negative_local_styles": ["heavy drums"],
"duration_ms": 15000,
"lines": ["First line of lyrics", "Second line"]
}
]
},
"musicLengthMs": 180000,
"seed": 877369,
"forceInstrumental": False,
"respectSectionsDurations": True,
"outputFormat": "mp3_44100_128",
"storeForInpainting": False,
"signWithC2pa": False
}
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: 'music_v1',
prompt: 'A melancholic indie folk song with acoustic guitar and soft vocals',
compositionPlan: {
positive_global_styles: ['epic orchestral', 'cinematic'],
negative_global_styles: ['lo-fi', 'acoustic'],
sections: [
{
section_name: 'Verse',
positive_local_styles: ['soft piano', 'building tension'],
negative_local_styles: ['heavy drums'],
duration_ms: 15000,
lines: ['First line of lyrics', 'Second line']
}
]
},
musicLengthMs: 180000,
seed: 877369,
forceInstrumental: false,
respectSectionsDurations: true,
outputFormat: 'mp3_44100_128',
storeForInpainting: false,
signWithC2pa: false
})
};
fetch('https://api.mountsea.ai/eleven/music', 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.mountsea.ai/eleven/music",
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' => 'music_v1',
'prompt' => 'A melancholic indie folk song with acoustic guitar and soft vocals',
'compositionPlan' => [
'positive_global_styles' => [
'epic orchestral',
'cinematic'
],
'negative_global_styles' => [
'lo-fi',
'acoustic'
],
'sections' => [
[
'section_name' => 'Verse',
'positive_local_styles' => [
'soft piano',
'building tension'
],
'negative_local_styles' => [
'heavy drums'
],
'duration_ms' => 15000,
'lines' => [
'First line of lyrics',
'Second line'
]
]
]
],
'musicLengthMs' => 180000,
'seed' => 877369,
'forceInstrumental' => false,
'respectSectionsDurations' => true,
'outputFormat' => 'mp3_44100_128',
'storeForInpainting' => false,
'signWithC2pa' => false
]),
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.mountsea.ai/eleven/music"
payload := strings.NewReader("{\n \"model\": \"music_v1\",\n \"prompt\": \"A melancholic indie folk song with acoustic guitar and soft vocals\",\n \"compositionPlan\": {\n \"positive_global_styles\": [\n \"epic orchestral\",\n \"cinematic\"\n ],\n \"negative_global_styles\": [\n \"lo-fi\",\n \"acoustic\"\n ],\n \"sections\": [\n {\n \"section_name\": \"Verse\",\n \"positive_local_styles\": [\n \"soft piano\",\n \"building tension\"\n ],\n \"negative_local_styles\": [\n \"heavy drums\"\n ],\n \"duration_ms\": 15000,\n \"lines\": [\n \"First line of lyrics\",\n \"Second line\"\n ]\n }\n ]\n },\n \"musicLengthMs\": 180000,\n \"seed\": 877369,\n \"forceInstrumental\": false,\n \"respectSectionsDurations\": true,\n \"outputFormat\": \"mp3_44100_128\",\n \"storeForInpainting\": false,\n \"signWithC2pa\": false\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.mountsea.ai/eleven/music")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"music_v1\",\n \"prompt\": \"A melancholic indie folk song with acoustic guitar and soft vocals\",\n \"compositionPlan\": {\n \"positive_global_styles\": [\n \"epic orchestral\",\n \"cinematic\"\n ],\n \"negative_global_styles\": [\n \"lo-fi\",\n \"acoustic\"\n ],\n \"sections\": [\n {\n \"section_name\": \"Verse\",\n \"positive_local_styles\": [\n \"soft piano\",\n \"building tension\"\n ],\n \"negative_local_styles\": [\n \"heavy drums\"\n ],\n \"duration_ms\": 15000,\n \"lines\": [\n \"First line of lyrics\",\n \"Second line\"\n ]\n }\n ]\n },\n \"musicLengthMs\": 180000,\n \"seed\": 877369,\n \"forceInstrumental\": false,\n \"respectSectionsDurations\": true,\n \"outputFormat\": \"mp3_44100_128\",\n \"storeForInpainting\": false,\n \"signWithC2pa\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/eleven/music")
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\": \"music_v1\",\n \"prompt\": \"A melancholic indie folk song with acoustic guitar and soft vocals\",\n \"compositionPlan\": {\n \"positive_global_styles\": [\n \"epic orchestral\",\n \"cinematic\"\n ],\n \"negative_global_styles\": [\n \"lo-fi\",\n \"acoustic\"\n ],\n \"sections\": [\n {\n \"section_name\": \"Verse\",\n \"positive_local_styles\": [\n \"soft piano\",\n \"building tension\"\n ],\n \"negative_local_styles\": [\n \"heavy drums\"\n ],\n \"duration_ms\": 15000,\n \"lines\": [\n \"First line of lyrics\",\n \"Second line\"\n ]\n }\n ]\n },\n \"musicLengthMs\": 180000,\n \"seed\": 877369,\n \"forceInstrumental\": false,\n \"respectSectionsDurations\": true,\n \"outputFormat\": \"mp3_44100_128\",\n \"storeForInpainting\": false,\n \"signWithC2pa\": false\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}ElevenLabs
生成音乐
从文本提示或作曲计划创建音乐
POST
/
eleven
/
music
音乐生成
curl --request POST \
--url https://api.mountsea.ai/eleven/music \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "music_v1",
"prompt": "A melancholic indie folk song with acoustic guitar and soft vocals",
"compositionPlan": {
"positive_global_styles": [
"epic orchestral",
"cinematic"
],
"negative_global_styles": [
"lo-fi",
"acoustic"
],
"sections": [
{
"section_name": "Verse",
"positive_local_styles": [
"soft piano",
"building tension"
],
"negative_local_styles": [
"heavy drums"
],
"duration_ms": 15000,
"lines": [
"First line of lyrics",
"Second line"
]
}
]
},
"musicLengthMs": 180000,
"seed": 877369,
"forceInstrumental": false,
"respectSectionsDurations": true,
"outputFormat": "mp3_44100_128",
"storeForInpainting": false,
"signWithC2pa": false
}
'import requests
url = "https://api.mountsea.ai/eleven/music"
payload = {
"model": "music_v1",
"prompt": "A melancholic indie folk song with acoustic guitar and soft vocals",
"compositionPlan": {
"positive_global_styles": ["epic orchestral", "cinematic"],
"negative_global_styles": ["lo-fi", "acoustic"],
"sections": [
{
"section_name": "Verse",
"positive_local_styles": ["soft piano", "building tension"],
"negative_local_styles": ["heavy drums"],
"duration_ms": 15000,
"lines": ["First line of lyrics", "Second line"]
}
]
},
"musicLengthMs": 180000,
"seed": 877369,
"forceInstrumental": False,
"respectSectionsDurations": True,
"outputFormat": "mp3_44100_128",
"storeForInpainting": False,
"signWithC2pa": False
}
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: 'music_v1',
prompt: 'A melancholic indie folk song with acoustic guitar and soft vocals',
compositionPlan: {
positive_global_styles: ['epic orchestral', 'cinematic'],
negative_global_styles: ['lo-fi', 'acoustic'],
sections: [
{
section_name: 'Verse',
positive_local_styles: ['soft piano', 'building tension'],
negative_local_styles: ['heavy drums'],
duration_ms: 15000,
lines: ['First line of lyrics', 'Second line']
}
]
},
musicLengthMs: 180000,
seed: 877369,
forceInstrumental: false,
respectSectionsDurations: true,
outputFormat: 'mp3_44100_128',
storeForInpainting: false,
signWithC2pa: false
})
};
fetch('https://api.mountsea.ai/eleven/music', 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.mountsea.ai/eleven/music",
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' => 'music_v1',
'prompt' => 'A melancholic indie folk song with acoustic guitar and soft vocals',
'compositionPlan' => [
'positive_global_styles' => [
'epic orchestral',
'cinematic'
],
'negative_global_styles' => [
'lo-fi',
'acoustic'
],
'sections' => [
[
'section_name' => 'Verse',
'positive_local_styles' => [
'soft piano',
'building tension'
],
'negative_local_styles' => [
'heavy drums'
],
'duration_ms' => 15000,
'lines' => [
'First line of lyrics',
'Second line'
]
]
]
],
'musicLengthMs' => 180000,
'seed' => 877369,
'forceInstrumental' => false,
'respectSectionsDurations' => true,
'outputFormat' => 'mp3_44100_128',
'storeForInpainting' => false,
'signWithC2pa' => false
]),
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.mountsea.ai/eleven/music"
payload := strings.NewReader("{\n \"model\": \"music_v1\",\n \"prompt\": \"A melancholic indie folk song with acoustic guitar and soft vocals\",\n \"compositionPlan\": {\n \"positive_global_styles\": [\n \"epic orchestral\",\n \"cinematic\"\n ],\n \"negative_global_styles\": [\n \"lo-fi\",\n \"acoustic\"\n ],\n \"sections\": [\n {\n \"section_name\": \"Verse\",\n \"positive_local_styles\": [\n \"soft piano\",\n \"building tension\"\n ],\n \"negative_local_styles\": [\n \"heavy drums\"\n ],\n \"duration_ms\": 15000,\n \"lines\": [\n \"First line of lyrics\",\n \"Second line\"\n ]\n }\n ]\n },\n \"musicLengthMs\": 180000,\n \"seed\": 877369,\n \"forceInstrumental\": false,\n \"respectSectionsDurations\": true,\n \"outputFormat\": \"mp3_44100_128\",\n \"storeForInpainting\": false,\n \"signWithC2pa\": false\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.mountsea.ai/eleven/music")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"music_v1\",\n \"prompt\": \"A melancholic indie folk song with acoustic guitar and soft vocals\",\n \"compositionPlan\": {\n \"positive_global_styles\": [\n \"epic orchestral\",\n \"cinematic\"\n ],\n \"negative_global_styles\": [\n \"lo-fi\",\n \"acoustic\"\n ],\n \"sections\": [\n {\n \"section_name\": \"Verse\",\n \"positive_local_styles\": [\n \"soft piano\",\n \"building tension\"\n ],\n \"negative_local_styles\": [\n \"heavy drums\"\n ],\n \"duration_ms\": 15000,\n \"lines\": [\n \"First line of lyrics\",\n \"Second line\"\n ]\n }\n ]\n },\n \"musicLengthMs\": 180000,\n \"seed\": 877369,\n \"forceInstrumental\": false,\n \"respectSectionsDurations\": true,\n \"outputFormat\": \"mp3_44100_128\",\n \"storeForInpainting\": false,\n \"signWithC2pa\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/eleven/music")
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\": \"music_v1\",\n \"prompt\": \"A melancholic indie folk song with acoustic guitar and soft vocals\",\n \"compositionPlan\": {\n \"positive_global_styles\": [\n \"epic orchestral\",\n \"cinematic\"\n ],\n \"negative_global_styles\": [\n \"lo-fi\",\n \"acoustic\"\n ],\n \"sections\": [\n {\n \"section_name\": \"Verse\",\n \"positive_local_styles\": [\n \"soft piano\",\n \"building tension\"\n ],\n \"negative_local_styles\": [\n \"heavy drums\"\n ],\n \"duration_ms\": 15000,\n \"lines\": [\n \"First line of lyrics\",\n \"Second line\"\n ]\n }\n ]\n },\n \"musicLengthMs\": 180000,\n \"seed\": 877369,\n \"forceInstrumental\": false,\n \"respectSectionsDurations\": true,\n \"outputFormat\": \"mp3_44100_128\",\n \"storeForInpainting\": false,\n \"signWithC2pa\": false\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}使用 ElevenLabs 音乐模型(
music_v1 / music_v2)生成音乐。对应官方 POST /v1/music/detailed — 结果包含歌词时间戳、作曲计划等元数据。
支持两种互斥的输入模式:
- 提示模式:提供简单文本
prompt— 快速便捷 - 作曲计划模式:提供结构化的
compositionPlan,按段落精细控制风格、时长和歌词
这是一个异步任务。响应中包含
taskId — 使用获取任务状态轮询生成的音频。模式说明
简单提示
设置prompt 描述所需音乐。可选设置 forceInstrumental: true 生成纯器乐。此模式建议填写 musicLengthMs。
作曲计划
设置compositionPlan,包含 positive_global_styles、negative_global_styles 和 sections 数组。每个段落可有独立的 section_name、positive_local_styles、negative_local_styles、duration_ms 和 lines(歌词)。曲目长度由段落时长决定。
先使用创建作曲计划从文本提示生成计划(免费,不消耗积分),查看后再传入此处。
常用选项
| 参数 | 说明 |
|---|---|
model | 必填。使用 music_v1 或 music_v2 |
respectSectionsDurations | 仅作曲计划模式;默认 true |
storeForInpainting | 企业 Inpainting;保存结果供后续编辑 |
signWithC2pa | 嵌入 C2PA AI 来源证明(仅 MP3) |
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
模型 ID
可用选项:
music_v1, music_v2, eleven_multilingual_v2, eleven_turbo_v2_5, eleven_flash_v2_5, eleven_v3 示例:
"music_v1"
简单文字提示(与 compositionPlan 互斥)
示例:
"A melancholic indie folk song with acoustic guitar and soft vocals"
详细作曲计划(与 prompt 互斥,通过 /eleven/plan 生成)
Show child attributes
Show child attributes
歌曲长度(毫秒),范围 3000-600000ms。prompt 模式建议填写;compositionPlan 模式由段落时长决定
必填范围:
3000 <= x <= 600000示例:
180000
随机种子
示例:
877369
强制纯器乐,仅 prompt 模式
是否严格遵守段落时长,仅 compositionPlan 模式
输出格式,格式为 codec_sampleRate_bitrate。MP3 192kbps 需要 Creator 及以上,PCM 44.1kHz 需要 Pro 及以上
可用选项:
mp3_22050_32, mp3_24000_48, mp3_44100_32, mp3_44100_64, mp3_44100_96, mp3_44100_128, mp3_44100_192, pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_32000, pcm_44100, pcm_48000, ulaw_8000, alaw_8000, opus_48000_32, opus_48000_64, opus_48000_96, opus_48000_128, opus_48000_192 是否保存生成结果用于后续 Inpainting 编辑。仅限具备 Inpainting 权限的企业客户使用
是否使用 C2PA 签名标记 AI 生成内容。仅适用于 MP3 输出格式,会在文件中嵌入加密的 AI 生成来源证明
响应
200 - application/json
任务创建成功
任务 ID,用于后续查询结果
⌘I