音频与其他ElevenLabs 音频接入
ElevenLabs 音效生成
使用 ModelSell 从文本描述生成短音效和可循环的环境音。
向 POST /elevenlabs/v1/sound-generation 提交 JSON 描述,响应返回一个音频文件。新接入请显式选择 eleven_text_to_sound_v3。省略 model_id 时接口默认使用 eleven_text_to_sound_v2,ElevenLabs 计划于 2027 年 3 月 1 日停用 v2。 创建音效 · ElevenLabs 模型生命周期
生成音效
参照 ElevenLabs 接入概览 设置 MODELSELL_BASE_URL 和 MODELSELL_API_KEY,并使用有权调用目标模型的 ModelSell 分组。
curl --fail-with-body \
"$MODELSELL_BASE_URL/elevenlabs/v1/sound-generation?output_format=mp3_44100_128" \
-H "xi-api-key: $MODELSELL_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model_id": "eleven_text_to_sound_v3",
"text": "Gentle rain on a wooden roof, with a few drips close to the listener",
"duration_seconds": 5,
"prompt_influence": 0.4,
"loop": true
}' \
--output rain.mp3| 字段 | 位置 | 含义 |
|---|---|---|
text | JSON | 必填,描述声源、场景和声音出现的时机。 |
duration_seconds | JSON | 0.5 至 30 秒。省略或传 null 时由 ElevenLabs 决定。 |
prompt_influence | JSON | 0 至 1,默认 0.3。数值越高,生成越贴近描述。 |
loop | JSON | 设为 true,生成适合连续循环的音效。 |
output_format | 查询参数 | 默认 mp3_44100_128。可选格式取决于上游设置和套餐。 |
enable_logging | 查询参数 | 上游默认 true。使用 false 需要符合条件的 ElevenLabs 套餐。 |
按 output_format 选择文件扩展名并保存响应体。较长的循环环境音可以在播放时重复拼接单次生成的片段。 音效接口参数 · 音效能力说明
计费
ModelSell 按模型配置的单次价格计费。duration_seconds 控制生成的片段时长,上游的套餐或 API 费率可能采用其他计价方式。 ModelSell 价格 · ElevenLabs 音效计价