上传音频(Inpainting 前置步骤)
curl --request POST \
--url https://api.mountsea.ai/eleven/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audioUrl": "https://example.com/song.mp3",
"extractCompositionPlan": false
}
'import requests
url = "https://api.mountsea.ai/eleven/upload"
payload = {
"audioUrl": "https://example.com/song.mp3",
"extractCompositionPlan": 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({audioUrl: 'https://example.com/song.mp3', extractCompositionPlan: false})
};
fetch('https://api.mountsea.ai/eleven/upload', 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/upload",
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([
'audioUrl' => 'https://example.com/song.mp3',
'extractCompositionPlan' => 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/upload"
payload := strings.NewReader("{\n \"audioUrl\": \"https://example.com/song.mp3\",\n \"extractCompositionPlan\": 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/upload")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"audioUrl\": \"https://example.com/song.mp3\",\n \"extractCompositionPlan\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/eleven/upload")
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 \"audioUrl\": \"https://example.com/song.mp3\",\n \"extractCompositionPlan\": false\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}ElevenLabs
上传音频
上传音频用于 Inpainting 编辑(企业版)
POST
/
eleven
/
upload
上传音频(Inpainting 前置步骤)
curl --request POST \
--url https://api.mountsea.ai/eleven/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"audioUrl": "https://example.com/song.mp3",
"extractCompositionPlan": false
}
'import requests
url = "https://api.mountsea.ai/eleven/upload"
payload = {
"audioUrl": "https://example.com/song.mp3",
"extractCompositionPlan": 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({audioUrl: 'https://example.com/song.mp3', extractCompositionPlan: false})
};
fetch('https://api.mountsea.ai/eleven/upload', 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/upload",
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([
'audioUrl' => 'https://example.com/song.mp3',
'extractCompositionPlan' => 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/upload"
payload := strings.NewReader("{\n \"audioUrl\": \"https://example.com/song.mp3\",\n \"extractCompositionPlan\": 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/upload")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"audioUrl\": \"https://example.com/song.mp3\",\n \"extractCompositionPlan\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/eleven/upload")
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 \"audioUrl\": \"https://example.com/song.mp3\",\n \"extractCompositionPlan\": false\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}此端点仅限具备 Inpainting 权限的企业客户使用。
song_id 用于 Inpainting 编辑。
这是一个异步任务。响应中包含
taskId — 使用获取任务状态轮询获取 songId 和可选的 compositionPlan。Inpainting 工作流程
1
上传音频
调用
POST /eleven/upload 传入音频 URL,获取 song_id。2
在作曲计划中引用
在
POST /eleven/music 中,使用 song_id 填入 compositionPlan.sections[].source_from,引用上传歌曲的特定片段。3
定义编辑范围
使用
source_from.range 指定要保留的时间范围,negative_ranges 排除该范围内的子片段。设置
extractCompositionPlan: true 可同时提取上传音频的结构作为作曲计划,然后修改并用于重新生成。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
响应
200 - application/json
任务创建成功
任务 ID,用于后续查询结果
⌘I