音频
生成 Runway 音效
使用 Runway API 根据文本 Prompt 生成音效或音频场景。
POST
/
runwayml
/
v1
/
sound_effect
curl https://api.cometapi.com/runwayml/v1/sound_effect \
--request POST \
--header "Authorization: Bearer $COMETAPI_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "eleven_text_to_sound_v2",
"promptText": "Gentle rain falling on a wooden roof with distant thunder.",
"duration": 5.5,
"loop": true
}'
{
"id": "123e4567-e89b-42d3-a456-426614174000"
}{
"code": "<string>",
"message": "<string>",
"data": "<unknown>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}使用
对于
对于三个速率控制项,请省略该字段或使用
POST /runwayml/v1/sound_effect 根据文本 Prompt 创建音频任务。
使用 Bearer 身份验证和 JSON 请求正文发送您的 CometAPI API 密钥。
选择模型
| 模型 ID | 必需输入 | 可选控制项 |
|---|---|---|
eleven_text_to_sound_v2 | promptText 包含 1–3000 个字符 | duration 从 0.5 到 30 秒,包括小数秒; loop |
seed_audio | promptText 包含 1–2048 个字符 | 最多三个 referenceAudios;语音、响度和音高控制;输出格式 |
eleven_text_to_sound_v2,请省略 duration,以便根据
Prompt 选择时长。设置 loop: true 可请求循环播放的音效。
对于 seed_audio,请在 Prompt 中将 referenceAudios 称为 @Audio1、@Audio2,
以及 @Audio3,顺序与数组中的顺序一致。无需参考时,请省略 referenceAudios。
将每个示例音频 URL 替换为您的音频文件可访问的 HTTPS URL。
请勿在此端点上对该模型包含 duration、loop 或 voice。
配置音频控制项
| 字段 | 取值 | 含义 |
|---|---|---|
speechRate | -50 到 100 之间的整数 | 负值会减慢语速;正值会加快语速。 |
loudnessRate | -50 到 100 之间的整数 | 负值会降低音量;正值会提高音量。 |
pitchRate | -12 到 12 之间的整数 | 以半音为单位调整音高。 |
sampleRate | 8000, 16000, 24000, 32000, 44100, 48000 | 以 Hz 为单位的音频采样率。 |
outputFormat | wav, mp3, ogg_opus | 输出音频格式。 |
0 以保留其正常值。
获取结果
保存返回的id,然后使用 获取 Runway 任务
以获取任务状态。当 status 为 SUCCEEDED 时,读取音频 URL 所在的字段
output。如果任务失败,请检查 failure 和 failureCode。请求体
application/json
- eleven_text_to_sound_v2
- seed_audio
Request settings for eleven_text_to_sound_v2.
响应
Task created. Save the returned id to retrieve task status.
最后修改于 2026年9月22日
⌘I
curl https://api.cometapi.com/runwayml/v1/sound_effect \
--request POST \
--header "Authorization: Bearer $COMETAPI_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "eleven_text_to_sound_v2",
"promptText": "Gentle rain falling on a wooden roof with distant thunder.",
"duration": 5.5,
"loop": true
}'
{
"id": "123e4567-e89b-42d3-a456-426614174000"
}{
"code": "<string>",
"message": "<string>",
"data": "<unknown>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}