查询任务
- Flow Music 的任务查询接口
- 与 Suno 系列的查询是同一个端点
- 路径
/v1/music/tasks/{task_id}
认证
All endpoints authenticate with a Bearer token.
Get an API key: open the console and create one.
Add it to the request header:
Authorization: Bearer YOUR_OAIRoute_KEY请求参数
路径参数
提交任务时返回的 ID,取自提交响应里的 data[0].task_id。
查询参数
错误信息与提示文案的语言,默认 zh。
可选值:zh、en、ja、ko。
只影响错误描述的语言,不改变其他内容。
Flow Music 与 Suno 共用这一个查询端点。无论你提交的是 flowmusic 还是 suno 任务,都用同一个地址查。
Path parameters
The ID returned at submission, taken from data[0].task_id in the submission response.
Query parameters
The language for error messages and hint text; defaults to zh.
Options: zh, en, ja, ko.
Affects only the language of error descriptions, nothing else.
Flow Music and Suno share this one query endpoint. Whether you submitted a flowmusic or a suno task, query it at the same address.
响应
顶层
状态码,成功为 200。
任务详情容器。
data 任务字段
任务 ID。
任务状态,取值 pending、processing、completed、failed。
进度,0 到 100。
创建时间,Unix 时间戳。
完成时间,Unix 时间戳。
实际耗时,单位秒。
实际扣费金额。失败通常为 0。
实际消耗的 credits。
生成结果。按能力不同结构不同,这是本接口最需要注意的地方。
result.music[] 音乐类任务
片段 ID。
标题。
时长,单位秒。注意是字符串形式的数值。
音频地址,m4a 格式。
WAV 地址。
视频地址,如视频渲染结果。
附加文件地址,如分轨 zip。
result.lyrics[] 歌词类任务
歌词标题。
歌词正文,带段落标记。
错误响应
错误描述。
错误类型,如 invalid_request、rate_limit_error。
出错的参数名。无特定参数时为空串。
错误码,如 task_not_found、rate_limit_error。
Top level
The status code; 200 on success.
The task detail container.
data task fields
The task ID.
The task status: pending, processing, completed, or failed.
Progress, 0 to 100.
Creation time, Unix timestamp.
Completion time, Unix timestamp.
Actual duration in seconds.
The amount actually charged. Typically 0 on failure.
The credits actually consumed.
The generation result. The structure varies by capability, which is the most important thing to note about this endpoint.
result.music[] for music tasks
The clip ID.
The title.
Duration in seconds. Note it's a number in string form.
The audio URL, m4a format.
The WAV URL.
The video URL, e.g. a video render result.
The URL of an attached file, e.g. a stems zip.
result.lyrics[] for lyrics tasks
The lyrics title.
The lyrics body, with section tags.
Error response
The error description.
The error type, e.g. invalid_request or rate_limit_error.
The name of the offending parameter. An empty string when there's no specific parameter.
The error code, e.g. task_not_found or rate_limit_error.
结果结构随能力变化
这是最容易踩的坑:同一个端点,不同任务类型返回的 result 结构不同。
| 任务类型 | 结果位置 |
|---|---|
| 生成音乐 | result.music[] |
| 生成歌词 | result.lyrics[] |
| 分轨(Flow Music) | result.music[].file_url |
| 视频渲染 | result.music[].video_url 或 result.videoUrl |
| 歌词时间轴 | result.alignment |
| BPM 分析 | result 下的速度字段 |
写解析代码时,先按任务类型分支,再取对应字段。指望一个通用的读取函数适配全部,会到处拿不到值。
duration_seconds 是字符串。直接参与算术会变成字符串拼接,需要先转数值。
This is the easiest trap: the same endpoint returns different result structures for different task types.
| Task type | Result location |
|---|---|
| Generate music | result.music[] |
| Generate lyrics | result.lyrics[] |
| Stem separation (Flow Music) | result.music[].file_url |
| Video render | result.music[].video_url or result.videoUrl |
| Lyrics timeline | result.alignment |
| BPM analysis | A tempo field under result |
When writing parsing code, branch on the task type first, then read the matching field. Expecting one generic reader to handle everything will leave you with missing values everywhere.
duration_seconds is a string. Using it directly in arithmetic concatenates strings; convert it to a number first.
轮询建议
| 任务类型 | 间隔 | 预期耗时 |
|---|---|---|
| 音乐生成 | 3 到 5 秒 | 30 到 120 秒 |
| 歌词、标签增强 | 3 到 5 秒 | 10 到 40 秒 |
| 下载任务 | 2 秒 | 通常 15 秒内 |
| 模型训练 | 10 到 30 秒 | 数分钟到 20 分钟 |
| Task type | Interval | Expected duration |
|---|---|---|
| Music generation | 3 to 5 s | 30 to 120 s |
| Lyrics, tag enhancement | 3 to 5 s | 10 to 40 s |
| Download tasks | 2 s | Usually within 15 s |
| Model training | 10 to 30 s | Minutes up to 20 minutes |
错误码
For error response formats, status codes, and retry guidance see Error codes and rate limits; for troubleshooting steps on common errors see the FAQ.
使用示例
提交一个任务并拿到 task_id:
提交成功只表示任务已受理。真正的产物要拿返回的 task_id 去任务查询接口轮询,status 变成 completed 之后才有结果。
Submit a task and get a task_id:
A successful submission only means the task was accepted. To get the actual output, poll the task query endpoint with the returned task_id; results appear only after status becomes completed.