进阶 docs.leonardo.ai 2026-11-22 15:11:20 · 0 阅读
第4章 使用 Leonardo.AI API 生成音效(Sound Effects v3)
音效生成 v3
本指南展示了如何通过 Leonardo.AI REST API,使用 Sound Effects v3 模型生成音效。
示例请求
curl --request POST \
--url https://cloud.leonardo.ai/api/rest/v2/generations \
--header 'accept: application/json' \
--header 'authorization: Bearer <YOUR_API_KEY>' \
--header 'content-type: application/json' \
--data '
{
"model": "elevenlabs/sound-effects-v3",
"public": false,
"parameters": {
"prompt": "Thunder rumbling in the distance followed by heavy rain on a tin roof",
"duration": 10,
"prompt_influence": 0.7,
"quantity": 1
}
}
'
API 端点、请求头与参数
端点
https://cloud.leonardo.ai/api/rest/v2/generations
请求头
--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"
请求体参数
| 参数 | 类型 | 定义 |
|---|---|---|
duration |
number | 生成音效的时长(秒)。可设为 1 到 30 之间的任意整数。默认值为 2。 |
model |
string | 指定生成时使用的模型。设为 elevenlabs/sound-effects-v3。 |
prompt |
string | 生成音效的文字描述。最大长度 9999 个字符。 |
prompt_influence |
number | 控制生成结果与提示词的一致程度。取值范围为 0 到 1。默认值为 0.7。 |
public |
boolean | 控制生成的音频是公开(true)还是私有(false)。 |
quantity |
number | 生成输出的数量。可设为 1、2、3 或 4。默认值为 1。 |
2 天前更新 本页对你有帮助吗?