音色复刻
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/voice/clone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "glm-tts-clone",
"voice_name": "my_custom_voice_001",
"input": "欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。",
"file_id": "file_abc123def456ghi789",
"text": "你好,这是一段示例音频的文本内容,用于音色复刻参考。",
"request_id": "<string>"
}
'import requests
url = "https://open.bigmodel.cn/api/paas/v4/voice/clone"
payload = {
"model": "glm-tts-clone",
"voice_name": "my_custom_voice_001",
"input": "欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。",
"file_id": "file_abc123def456ghi789",
"text": "你好,这是一段示例音频的文本内容,用于音色复刻参考。",
"request_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'glm-tts-clone',
voice_name: 'my_custom_voice_001',
input: '欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。',
file_id: 'file_abc123def456ghi789',
text: '你好,这是一段示例音频的文本内容,用于音色复刻参考。',
request_id: '<string>'
})
};
fetch('https://open.bigmodel.cn/api/paas/v4/voice/clone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/voice/clone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"glm-tts-clone\",\n \"voice_name\": \"my_custom_voice_001\",\n \"input\": \"欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。\",\n \"file_id\": \"file_abc123def456ghi789\",\n \"text\": \"你好,这是一段示例音频的文本内容,用于音色复刻参考。\",\n \"request_id\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/paas/v4/voice/clone"
payload := strings.NewReader("{\n \"model\": \"glm-tts-clone\",\n \"voice_name\": \"my_custom_voice_001\",\n \"input\": \"欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。\",\n \"file_id\": \"file_abc123def456ghi789\",\n \"text\": \"你好,这是一段示例音频的文本内容,用于音色复刻参考。\",\n \"request_id\": \"<string>\"\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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/voice/clone",
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' => 'glm-tts-clone',
'voice_name' => 'my_custom_voice_001',
'input' => '欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。',
'file_id' => 'file_abc123def456ghi789',
'text' => '你好,这是一段示例音频的文本内容,用于音色复刻参考。',
'request_id' => '<string>'
]),
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;
}{
"voice": "voice_clone_20240315_143052_001",
"file_id": "file_xyz789abc456def123",
"file_purpose": "voice-clone-output",
"request_id": "voice_clone_req_20240315_143052_001"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}模型 API
音色复刻
使用音色复刻技术,基于示例音频生成指定音色、文本内容的语音合成。点击 Try it 按钮可快速试用。
POST
/
paas
/
v4
/
voice
/
clone
音色复刻
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/voice/clone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "glm-tts-clone",
"voice_name": "my_custom_voice_001",
"input": "欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。",
"file_id": "file_abc123def456ghi789",
"text": "你好,这是一段示例音频的文本内容,用于音色复刻参考。",
"request_id": "<string>"
}
'import requests
url = "https://open.bigmodel.cn/api/paas/v4/voice/clone"
payload = {
"model": "glm-tts-clone",
"voice_name": "my_custom_voice_001",
"input": "欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。",
"file_id": "file_abc123def456ghi789",
"text": "你好,这是一段示例音频的文本内容,用于音色复刻参考。",
"request_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'glm-tts-clone',
voice_name: 'my_custom_voice_001',
input: '欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。',
file_id: 'file_abc123def456ghi789',
text: '你好,这是一段示例音频的文本内容,用于音色复刻参考。',
request_id: '<string>'
})
};
fetch('https://open.bigmodel.cn/api/paas/v4/voice/clone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/paas/v4/voice/clone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"glm-tts-clone\",\n \"voice_name\": \"my_custom_voice_001\",\n \"input\": \"欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。\",\n \"file_id\": \"file_abc123def456ghi789\",\n \"text\": \"你好,这是一段示例音频的文本内容,用于音色复刻参考。\",\n \"request_id\": \"<string>\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/paas/v4/voice/clone"
payload := strings.NewReader("{\n \"model\": \"glm-tts-clone\",\n \"voice_name\": \"my_custom_voice_001\",\n \"input\": \"欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。\",\n \"file_id\": \"file_abc123def456ghi789\",\n \"text\": \"你好,这是一段示例音频的文本内容,用于音色复刻参考。\",\n \"request_id\": \"<string>\"\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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/paas/v4/voice/clone",
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' => 'glm-tts-clone',
'voice_name' => 'my_custom_voice_001',
'input' => '欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。',
'file_id' => 'file_abc123def456ghi789',
'text' => '你好,这是一段示例音频的文本内容,用于音色复刻参考。',
'request_id' => '<string>'
]),
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;
}{
"voice": "voice_clone_20240315_143052_001",
"file_id": "file_xyz789abc456def123",
"file_purpose": "voice-clone-output",
"request_id": "voice_clone_req_20240315_143052_001"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Body
application/json
模型
Available options:
glm-tts-clone Example:
"glm-tts-clone"
指定唯一的音色名称
Example:
"my_custom_voice_001"
生成试听音频的目标文本内容
Example:
"欢迎使用我们的音色复刻服务,这将生成与示例音频相同音色的语音。"
示例音频的file_id,通过文件接口上传获取。大小限制不超过10M,建议音频时长在3秒到30秒之间。
Example:
"file_abc123def456ghi789"
示例音频的文本内容,选填
Example:
"你好,这是一段示例音频的文本内容,用于音色复刻参考。"
请求唯一标识符。由用户端传递,ID长度要求:最少6个字符,最多64个字符,建议使用UUID格式确保唯一性,若未提供平台将自动生成。
Required string length:
6 - 64Was this page helpful?
⌘I