查询任务
curl --request GET \
--url https://api.dreamto.ai/api/v1/jobs/recordInfo \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dreamto.ai/api/v1/jobs/recordInfo"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.dreamto.ai/api/v1/jobs/recordInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.dreamto.ai/api/v1/jobs/recordInfo';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.dreamto.ai/api/v1/jobs/recordInfo"
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.dreamto.ai/api/v1/jobs/recordInfo")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dreamto.ai/api/v1/jobs/recordInfo",
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;
}require 'uri'
require 'net/http'
url = URI("https://api.dreamto.ai/api/v1/jobs/recordInfo")
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_bodyusing RestSharp;
var options = new RestClientOptions("https://api.dreamto.ai/api/v1/jobs/recordInfo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
import Foundation
let url = URL(string: "https://api.dreamto.ai/api/v1/jobs/recordInfo")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["Authorization": "Bearer <token>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.dreamto.ai/api/v1/jobs/recordInfo")
.get()
.addHeader("Authorization", "Bearer <token>")
.build()
val response = client.newCall(request).execute()false{
"code": 200,
"msg": "success",
"data": {
"taskId": "7d3f0a9c41e85b2f6a1c9e04b8d27f53",
"model": "ai-music-api/create-voice",
"state": "waiting",
"param": "{\"input\":\"{\\\"task_id\\\":\\\"c2a81e5f09d34b7e8f61a2d4c9b03e75\\\",\\\"verify_url\\\":\\\"https://example.com/recordings/verify-phrase.mp3\\\",\\\"voice_name\\\":\\\"我的声音\\\",\\\"description\\\":\\\"温暖明亮的女中音\\\",\\\"style\\\":\\\"pop\\\",\\\"singer_skill_level\\\":\\\"intermediate\\\"}\",\"model\":\"ai-music-api/create-voice\"}",
"resultJson": null,
"failCode": null,
"failMsg": null,
"costTime": null,
"completeTime": null,
"createTime": 1795014897000,
"updateTime": 1795014907000
}
}
创建自定义音色
创建自定义音色:查询任务
按 taskId 查询任务状态和结果。data.state 为 success 时从 data.response(与 data.resultJson 相同)读取结果,为 fail 时 data.failCode / data.failMsg 为失败原因。建议每 10 秒左右查询一次。
GET
/
api
/
v1
/
jobs
/
recordInfo
查询任务
curl --request GET \
--url https://api.dreamto.ai/api/v1/jobs/recordInfo \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dreamto.ai/api/v1/jobs/recordInfo"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.dreamto.ai/api/v1/jobs/recordInfo', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.dreamto.ai/api/v1/jobs/recordInfo';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.dreamto.ai/api/v1/jobs/recordInfo"
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.dreamto.ai/api/v1/jobs/recordInfo")
.header("Authorization", "Bearer <token>")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dreamto.ai/api/v1/jobs/recordInfo",
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;
}require 'uri'
require 'net/http'
url = URI("https://api.dreamto.ai/api/v1/jobs/recordInfo")
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_bodyusing RestSharp;
var options = new RestClientOptions("https://api.dreamto.ai/api/v1/jobs/recordInfo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
import Foundation
let url = URL(string: "https://api.dreamto.ai/api/v1/jobs/recordInfo")!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.timeoutInterval = 10
request.allHTTPHeaderFields = ["Authorization": "Bearer <token>"]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.dreamto.ai/api/v1/jobs/recordInfo")
.get()
.addHeader("Authorization", "Bearer <token>")
.build()
val response = client.newCall(request).execute()false{
"code": 200,
"msg": "success",
"data": {
"taskId": "7d3f0a9c41e85b2f6a1c9e04b8d27f53",
"model": "ai-music-api/create-voice",
"state": "waiting",
"param": "{\"input\":\"{\\\"task_id\\\":\\\"c2a81e5f09d34b7e8f61a2d4c9b03e75\\\",\\\"verify_url\\\":\\\"https://example.com/recordings/verify-phrase.mp3\\\",\\\"voice_name\\\":\\\"我的声音\\\",\\\"description\\\":\\\"温暖明亮的女中音\\\",\\\"style\\\":\\\"pop\\\",\\\"singer_skill_level\\\":\\\"intermediate\\\"}\",\"model\":\"ai-music-api/create-voice\"}",
"resultJson": null,
"failCode": null,
"failMsg": null,
"costTime": null,
"completeTime": null,
"createTime": 1795014897000,
"updateTime": 1795014907000
}
}
响应
200 - application/json
HTTP 状态码始终为 200。code 为 200 时 data 为任务信息(任务本身是否成功看 data.state);其他 code 为错误,data 为 null。

