Lyria 3.5 音乐延伸
- 用 Lyria 3.5 做续写,异步任务
- 与普通延伸共用端点,靠
version区分 - 产出新的 clip_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请求参数
固定传 flowmusic,大小写不敏感。
不要改成 lyria-3.5 之类的写法——lyria-3.5 是版本,不是模型名。
固定传 lyria-3.5。
源 clip 标识,取自成功任务的 result.music[].clip_id。
也可以由上传音频接口换取。
续写起点,单位秒。不得超过源 clip 时长。
续写时长,单位秒。上限 164。
续写编辑指令,例如「延续主歌旋律,加入弦乐」。
续写后的标题。
随机种子,用于复现。
Always flowmusic, case-insensitive.
Don't change it to something like lyria-3.5 — lyria-3.5 is a version, not a model name.
Always lyria-3.5.
The source clip identifier, taken from result.music[].clip_id of a successful task.
It can also be obtained through the upload audio endpoint.
The extension start point in seconds. Must not exceed the source clip's duration.
Extension duration in seconds. Maximum 164.
The extension edit instruction, e.g. "continue the verse melody and add strings".
The title after extension.
A random seed for reproducing results.
两个上限
| 字段 | 上限 | 说明 |
|---|---|---|
extend_from_s | 源 clip 的实际时长 | 上界不固定,取决于源音频多长 |
extend_s | 164 秒 | 固定上限 |
第一个上限动态变化,所以要先查一次源任务拿到 duration_seconds,再决定起点。
duration_seconds 是字符串。比较大小前先转数值,否则字符串比较会给出错误结论。
| Field | Limit | Notes |
|---|---|---|
extend_from_s | The source clip's actual duration | The upper bound varies with source length |
extend_s | 164 seconds | Fixed upper bound |
The first limit is dynamic, so query the source task once to get duration_seconds before deciding the start point.
duration_seconds is a string. Convert it to a number before comparing, or string comparison gives the wrong conclusion.
提交响应
状态码,成功为 200。
初始为 submitted。
任务标识,用于查询进度与结果。
The status code; 200 on success.
Initially submitted.
The task identifier, used to query progress and results.
查询结果
任务 ID。
任务状态(如 completed)。
进度百分比。
创建时间戳。
完成时间戳。
实际耗时。
费用。
积分消耗。
结果对象。
result.music[] 元素
新生成的 clip 标识。后续操作使用此值,不是原来的。
曲目标题。
时长,字符串形式。
创建时间,ISO 8601 格式。
歌词文本。
歌词标识。
时间轴标记数组。
音频地址,m4a。
WAV 格式地址。
封面图地址。
The task ID.
The task status (e.g. completed).
Progress percentage.
Creation timestamp.
Completion timestamp.
Actual duration.
Cost.
Credits consumed.
The result object.
result.music[] entries
The newly generated clip identifier. Use this value for later operations, not the original.
The track title.
Duration as a string.
Creation time in ISO 8601 format.
The lyrics text.
The lyrics identifier.
The array of timeline markers.
The audio URL, m4a.
The WAV-format URL.
The cover image URL.
错误
| HTTP | code |
|---|---|
| 400 | invalid_request(如缺少 clip_id) |
| 429 | rate_limit_error |
错误描述。
错误类型。
出错参数。
错误码:invalid_request、quota_not_enough、rate_limit_error。
统一为 error 对象,常见 HTTP 状态:
| HTTP | code |
|---|---|
| 400 | invalid_request (e.g. missing clip_id) |
| 429 | rate_limit_error |
The error description.
The error type.
The offending parameter.
The error code: invalid_request, quota_not_enough, rate_limit_error.
Uniformly an error object; common HTTP statuses:
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.