提交获取带时间戳歌词任务
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "get-timestamped-lyrics",
"callback_url": "https://your-domain.com/callback",
"input": {
"task_id": "task-unified-1757165031-uyujaw3d",
"audio_id": "e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc"
}
}
'import requests
url = "https://api.poyo.ai/api/generate/submit"
payload = {
"model": "get-timestamped-lyrics",
"callback_url": "https://your-domain.com/callback",
"input": {
"task_id": "task-unified-1757165031-uyujaw3d",
"audio_id": "e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc"
}
}
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: 'get-timestamped-lyrics',
callback_url: 'https://your-domain.com/callback',
input: {
task_id: 'task-unified-1757165031-uyujaw3d',
audio_id: 'e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc'
}
})
};
fetch('https://api.poyo.ai/api/generate/submit', 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.poyo.ai/api/generate/submit",
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' => 'get-timestamped-lyrics',
'callback_url' => 'https://your-domain.com/callback',
'input' => [
'task_id' => 'task-unified-1757165031-uyujaw3d',
'audio_id' => 'e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc'
]
]),
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.poyo.ai/api/generate/submit"
payload := strings.NewReader("{\n \"model\": \"get-timestamped-lyrics\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"task_id\": \"task-unified-1757165031-uyujaw3d\",\n \"audio_id\": \"e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc\"\n }\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.poyo.ai/api/generate/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"get-timestamped-lyrics\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"task_id\": \"task-unified-1757165031-uyujaw3d\",\n \"audio_id\": \"e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.poyo.ai/api/generate/submit")
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\": \"get-timestamped-lyrics\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"task_id\": \"task-unified-1757165031-uyujaw3d\",\n \"audio_id\": \"e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"aligned_words": [
{
"word": "[Verse] Waggin'",
"success": true,
"start_s": 1.36,
"end_s": 1.79,
"palign": 0
}
],
"waveform_data": [
0,
1,
0.5,
0.75
],
"hoot_cer": 0.38,
"is_streamed": false
}
}{
"code": 404,
"error": {
"message": "Task or audio not found",
"type": "not_found_error"
}
}Suno AI
获取带时间戳的歌词
获取带有精确时间戳的同步歌词
POST
/
api
/
generate
/
submit
提交获取带时间戳歌词任务
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "get-timestamped-lyrics",
"callback_url": "https://your-domain.com/callback",
"input": {
"task_id": "task-unified-1757165031-uyujaw3d",
"audio_id": "e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc"
}
}
'import requests
url = "https://api.poyo.ai/api/generate/submit"
payload = {
"model": "get-timestamped-lyrics",
"callback_url": "https://your-domain.com/callback",
"input": {
"task_id": "task-unified-1757165031-uyujaw3d",
"audio_id": "e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc"
}
}
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: 'get-timestamped-lyrics',
callback_url: 'https://your-domain.com/callback',
input: {
task_id: 'task-unified-1757165031-uyujaw3d',
audio_id: 'e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc'
}
})
};
fetch('https://api.poyo.ai/api/generate/submit', 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.poyo.ai/api/generate/submit",
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' => 'get-timestamped-lyrics',
'callback_url' => 'https://your-domain.com/callback',
'input' => [
'task_id' => 'task-unified-1757165031-uyujaw3d',
'audio_id' => 'e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc'
]
]),
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.poyo.ai/api/generate/submit"
payload := strings.NewReader("{\n \"model\": \"get-timestamped-lyrics\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"task_id\": \"task-unified-1757165031-uyujaw3d\",\n \"audio_id\": \"e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc\"\n }\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.poyo.ai/api/generate/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"get-timestamped-lyrics\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"task_id\": \"task-unified-1757165031-uyujaw3d\",\n \"audio_id\": \"e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.poyo.ai/api/generate/submit")
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\": \"get-timestamped-lyrics\",\n \"callback_url\": \"https://your-domain.com/callback\",\n \"input\": {\n \"task_id\": \"task-unified-1757165031-uyujaw3d\",\n \"audio_id\": \"e231xxxx-xxxx-xxxx-xxxx-xxxx8cadc7dc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"aligned_words": [
{
"word": "[Verse] Waggin'",
"success": true,
"start_s": 1.36,
"end_s": 1.79,
"palign": 0
}
],
"waveform_data": [
0,
1,
0.5,
0.75
],
"hoot_cer": 0.38,
"is_streamed": false
}
}{
"code": 404,
"error": {
"message": "Task or audio not found",
"type": "not_found_error"
}
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询音乐详情接口获取结果。
使用指南
- 此接口获取已生成音轨的同步歌词及其精确时间戳
- 可用于制作卡拉 OK 式显示、字幕或歌词可视化
- 需要一个已完成且包含人声的音乐生成任务
参数详情
-
必填参数:
-
task_id:先前音乐生成任务的唯一标识 -
audio_id:任务结果中具体音轨的标识
-
- 这两个标识都可以从音乐生成接口的响应或其回调中获得
开发者说明
- 此接口仅适用于包含人声的音轨
hoot_cer(字符错误率)值表示对齐精度,值越低表示越准确- 使用
waveform_data可在歌词旁制作音频可视化效果
响应字段
-
aligned_words(array):带时间信息的歌词单词列表word(string):歌词文本,可能包含[Verse]、[Chorus]等段落标记start_s(number):单词开始时间(秒)end_s(number):单词结束时间(秒)success(boolean):该单词是否对齐成功palign(number):对齐置信度分数
-
waveform_data(array):用于音频波形可视化的数值数据 -
hoot_cer(number):对齐精度分数(字符错误率) -
is_streamed(boolean):表示该音频是否为流式音轨
授权
所有 API 接口都需要 Bearer Token 认证。
创建 API Key:登录 PoYo,进入 仪表盘 → API 密钥(poyo.ai/zh/dashboard/api-key),点击创建 Key。
在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
响应
成功获取带时间戳的歌词
Show child attributes
Show child attributes