生成歌词
- Flow Music 的歌词生成接口,异步任务
- 输出带
[Intro]、[Verse 1]等段落标记的歌词 - 结果可直接回填给「生成音乐」接口
认证
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请求参数
固定填 flowmusic,大小写不敏感。缺省时返回 model_required。
歌词生成提示词,长度不超过 3000 字符。
建议写清歌曲主题、风格与情绪。例如「一首关于坚持的摇滚歌曲」。
Always flowmusic, case-insensitive. Omitting it returns model_required.
The lyrics generation prompt, up to 3000 characters.
Describe the song's theme, style, and mood, e.g. "a rock song about perseverance".
提交响应
状态码,成功为 200。
任务状态,初始值为 submitted。
任务唯一标识,用于查询进度与结果。
The status code; 200 on success.
The task status; initially submitted.
The unique task identifier, used to query progress and results.
查询结果
用 GET /v1/music/tasks/{task_id} 查询。
歌词结果数组。
歌词标题。
歌词正文,带 [Intro]、[Verse 1]、[Chorus] 等段落标记。
Query with GET /v1/music/tasks/{task_id}.
The array of lyrics results.
The lyrics title.
The lyrics body, with section tags such as [Intro], [Verse 1], and [Chorus].
完整流程
歌词生成与音乐生成是两个独立任务,串起来用:
- 调本接口生成歌词,拿
task_id - 轮询拿到
result.lyrics[0]的title与lyrics - 把这两个值作为「生成音乐」的
title与lyrics入参 - 配上
sound_prompt描述风格,一起提交
这样歌词与曲风能同步,不会出现「词很燃、曲子很柔」的错配。
Lyrics generation and music generation are two separate tasks; chain them like this:
- Call this endpoint to generate lyrics and get a
task_id - Poll until you have
titleandlyricsfromresult.lyrics[0] - Pass those two values as
titleandlyricsto "Generate music" - Add a
sound_promptdescribing the style and submit together
This keeps lyrics and style in sync, avoiding the mismatch where the words are fierce and the music is soft.
错误
| HTTP | error.code | error.type | 说明 |
|---|---|---|---|
| 400 | model_required | invalid_request | model is required |
| 429 | rate_limit_error | rate_limit_error | 当前分组容量饱和,请稍后重试 |
这段路径拼写是 lyricsFlowMusic,不是 lyrics。Flow Music 的每个操作各有独立路径,别按 REST 惯例去猜。
| HTTP | error.code | error.type | Notes |
|---|---|---|---|
| 400 | model_required | invalid_request | model is required |
| 429 | rate_limit_error | rate_limit_error | Current group capacity is saturated; retry later |
The path spelling is lyricsFlowMusic, not lyrics. Each Flow Music operation has its own path — don't guess by REST convention.
For more 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.