音频
为 Runway 音频配音
使用 Runway API 将口语音频翻译成目标语言。
POST
/
runwayml
/
v1
/
voice_dubbing
cURL
curl https://api.cometapi.com/runwayml/v1/voice_dubbing \
--request POST \
--header "Authorization: Bearer $COMETAPI_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "eleven_voice_dubbing",
"audioUri": "https://your-audio-host/source-speech.mp3",
"targetLang": "es"
}'
import os
import requests
payload = { 'model': 'eleven_voice_dubbing',
'audioUri': 'https://your-audio-host/source-speech.mp3',
'targetLang': 'es'}
response = requests.post(
"https://api.cometapi.com/runwayml/v1/voice_dubbing",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json=payload,
)
response.raise_for_status()
print(response.json()["id"])
const payload = {
"model": "eleven_voice_dubbing",
"audioUri": "https://your-audio-host/source-speech.mp3",
"targetLang": "es"
};
const response = await fetch(
"https://api.cometapi.com/runwayml/v1/voice_dubbing",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
},
);
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
console.log(task.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/runwayml/v1/voice_dubbing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'eleven_voice_dubbing',
'audioUri' => 'https://your-audio-host/source-speech.mp3',
'targetLang' => 'es'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/runwayml/v1/voice_dubbing"
payload := strings.NewReader("{\n \"model\": \"eleven_voice_dubbing\",\n \"audioUri\": \"https://your-audio-host/source-speech.mp3\",\n \"targetLang\": \"es\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/runwayml/v1/voice_dubbing")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"eleven_voice_dubbing\",\n \"audioUri\": \"https://your-audio-host/source-speech.mp3\",\n \"targetLang\": \"es\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/runwayml/v1/voice_dubbing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"eleven_voice_dubbing\",\n \"audioUri\": \"https://your-audio-host/source-speech.mp3\",\n \"targetLang\": \"es\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-42d3-a456-426614174000"
}{
"code": "<string>",
"message": "<string>",
"data": "<unknown>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}使用
省略布尔控制参数即可使用模型默认值。发送
POST /runwayml/v1/voice_dubbing 将口语音频翻译成另一种
语言。使用模型 ID eleven_voice_dubbing。
使用 Bearer 身份验证发送您的 CometAPI API 密钥,并附带 JSON 请求正文。
提供音频和目标语言
将audioUri 设置为源音频的可访问 HTTPS URL。
将 targetLang 设置为目标语言代码,例如西班牙语使用 es
,法语使用 fr。请从请求架构中选择受支持的代码。
请求需要 model、audioUri 和 targetLang。
将示例音频 URL 替换为您的源文件。
配置配音
| 字段 | 操作 |
|---|---|
disableVoiceCloning | 将 true 设置为使用通用声音,而不是克隆源声音。 |
dropBackgroundAudio | 将 true 设置为移除配音输出中的背景音频。 |
numSpeakers | 为源说话人数量提供正整数;也可以省略此项以自动检测。 |
false 也会使用
默认值。
获取结果
保存返回的id,然后使用 获取 Runway 任务
来检索任务状态。当 status 为 SUCCEEDED 时,读取音频 URL
output。如果任务失败,请检查 failure 和 failureCode。请求体
application/json
Request settings for eleven_voice_dubbing.
响应
Task created. Save the returned id to retrieve task status.
最后修改于 2026年9月21日
⌘I
cURL
curl https://api.cometapi.com/runwayml/v1/voice_dubbing \
--request POST \
--header "Authorization: Bearer $COMETAPI_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "eleven_voice_dubbing",
"audioUri": "https://your-audio-host/source-speech.mp3",
"targetLang": "es"
}'
import os
import requests
payload = { 'model': 'eleven_voice_dubbing',
'audioUri': 'https://your-audio-host/source-speech.mp3',
'targetLang': 'es'}
response = requests.post(
"https://api.cometapi.com/runwayml/v1/voice_dubbing",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json=payload,
)
response.raise_for_status()
print(response.json()["id"])
const payload = {
"model": "eleven_voice_dubbing",
"audioUri": "https://your-audio-host/source-speech.mp3",
"targetLang": "es"
};
const response = await fetch(
"https://api.cometapi.com/runwayml/v1/voice_dubbing",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
},
);
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
console.log(task.id);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/runwayml/v1/voice_dubbing",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'eleven_voice_dubbing',
'audioUri' => 'https://your-audio-host/source-speech.mp3',
'targetLang' => 'es'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/runwayml/v1/voice_dubbing"
payload := strings.NewReader("{\n \"model\": \"eleven_voice_dubbing\",\n \"audioUri\": \"https://your-audio-host/source-speech.mp3\",\n \"targetLang\": \"es\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/runwayml/v1/voice_dubbing")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"eleven_voice_dubbing\",\n \"audioUri\": \"https://your-audio-host/source-speech.mp3\",\n \"targetLang\": \"es\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/runwayml/v1/voice_dubbing")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"eleven_voice_dubbing\",\n \"audioUri\": \"https://your-audio-host/source-speech.mp3\",\n \"targetLang\": \"es\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-42d3-a456-426614174000"
}{
"code": "<string>",
"message": "<string>",
"data": "<unknown>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}