查询任务状态
curl --request GET \
--url https://api.mountsea.ai/eleven/tasks \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mountsea.ai/eleven/tasks"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mountsea.ai/eleven/tasks', 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/tasks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mountsea.ai/eleven/tasks"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.mountsea.ai/eleven/tasks")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/eleven/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"taskId": "<string>",
"result": {},
"errorMessage": "<string>",
"errorCode": 123,
"finishedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"traceId": "<string>"
}ElevenLabs
获取任务状态
查询任务状态和结果
GET
/
eleven
/
tasks
查询任务状态
curl --request GET \
--url https://api.mountsea.ai/eleven/tasks \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mountsea.ai/eleven/tasks"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mountsea.ai/eleven/tasks', 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/tasks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mountsea.ai/eleven/tasks"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.mountsea.ai/eleven/tasks")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/eleven/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"taskId": "<string>",
"result": {},
"errorMessage": "<string>",
"errorCode": 123,
"finishedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"traceId": "<string>"
}所有异步端点(music、plan、video-to-music、dialogue、stems、upload)都返回
taskId。使用此端点轮询直到任务达到终态(completed、failed 或 timeout)。GET /eleven/voices 为同步接口,不走此端点。任务状态值
| 状态 | 描述 |
|---|---|
pending | 任务已排队 |
ready | 任务准备就绪 |
assigned | 任务已分配给工作节点 |
processing | 任务正在处理 |
completed | 任务完成 — 查看 result 获取数据 |
failed | 任务失败 — 查看 errorMessage |
cancelled | 任务已取消 |
timeout | 任务超时 |
建议 3-5 秒轮询间隔。音乐生成通常需要 30-120 秒,取决于曲目长度。
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
查询参数
任务ID (eleven-xxxxxxxx-...)
响应
200 - application/json
任务状态
任务 ID
任务状态
可用选项:
pending, ready, assigned, processing, completed, failed, cancelled, timeout 任务结果(直接透传协议层返回,类型根据任务类型不同而变化)
错误信息
错误代码
完成时间
创建时间
追踪 ID
⌘I