查询:批量查询任务
简洁描述:批量查询 Suno 音乐或歌词生成任务状态和结果。
概览
- 请求方法:
POST - 路径:
/suno/fetch - 内容类型:
application/json
认证方式
- Header:
Authorization: Bearer <token>
请求示例
请求体参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| ids | array | 是 | 任务 ID 列表 |
| action | string | 否 | 任务类型,MUSIC 表示歌曲任务,LYRICS 表示歌词任务 |
curl 示例
bash
curl -X POST "https://api.gpt.ge/suno/fetch" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{
"ids": [
"2a145658-3342-4228-b779-b8323a2b77df1",
"2a145658-3342-4228-b779-b8323a2b77df2"
],
"action": "MUSIC"
}'JavaScript (fetch) 示例
javascript
fetch('https://api.gpt.ge/suno/fetch', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-xxxx'
},
body: JSON.stringify({
ids: [
'2a145658-3342-4228-b779-b8323a2b77df1',
'2a145658-3342-4228-b779-b8323a2b77df2'
],
action: 'MUSIC'
})
}).then(r => r.json()).then(console.log);Python (requests) 示例
python
import requests
response = requests.post(
'https://api.gpt.ge/suno/fetch',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-xxxx'
},
json={
'ids': [
'2a145658-3342-4228-b779-b8323a2b77df1',
'2a145658-3342-4228-b779-b8323a2b77df2'
],
'action': 'MUSIC'
}
)
print(response.json())返回示例(200)
json
{
"code": "success",
"message": "",
"data": [
{
"task_id": "2a145658-3342-4228-b779-b8323a2b77df",
"action": "MUSIC",
"status": "SUCCESS",
"fail_reason": "",
"submit_time": 1726911801,
"start_time": 1726911812,
"finish_time": 1726911897,
"progress": "100%",
"data": [
{
"id": "3435e194-50e7-4edc-9442-bffe072fccfc",
"title": "快乐周末",
"handle": "yellowrobots6855",
"status": "complete",
"user_id": "ee5e241a-ead6-435d-bea8-526c77c04c72",
"is_liked": false,
"metadata": {
"tags": "heartfelt salsa",
"type": "gen",
"prompt": "",
"stream": true,
"history": null,
"duration": 128.92,
"error_type": null,
"error_message": null,
"concat_history": null,
"refund_credits": false,
"audio_prompt_id": null,
"gpt_description_prompt": null
},
"reaction": null,
"audio_url": "https://cdn1.suno.ai/3435e194-50e7-4edc-9442-bffe072fccfc.mp3",
"image_url": "https://cdn2.suno.ai/image_3435e194-50e7-4edc-9442-bffe072fccfc.jpeg",
"is_public": false,
"video_url": "https://cdn1.suno.ai/3435e194-50e7-4edc-9442-bffe072fccfc.mp4",
"created_at": "2024-09-21T09:43:21.637Z",
"is_trashed": false,
"model_name": "chirp-v3",
"play_count": 0,
"display_name": "YellowRobots6855",
"upvote_count": 0,
"image_large_url": "https://cdn2.suno.ai/image_large_3435e194-50e7-4edc-9442-bffe072fccfc.jpeg",
"is_video_pending": false,
"is_handle_updated": false,
"major_model_version": "v3.5"
}
]
}
]
}注意:此接口用于批量查询 Suno 任务状态,可根据
ids和可选action过滤歌曲或歌词任务。