GLM 语音合成
curl --request POST \
--url https://api.ppio.com/v3/glm-tts \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"input": "<string>",
"speed": 123,
"voice": "<string>",
"volume": 123,
"response_format": "<string>",
"watermark_enabled": true
}
'import requests
url = "https://api.ppio.com/v3/glm-tts"
payload = {
"input": "<string>",
"speed": 123,
"voice": "<string>",
"volume": 123,
"response_format": "<string>",
"watermark_enabled": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
input: '<string>',
speed: 123,
voice: '<string>',
volume: 123,
response_format: '<string>',
watermark_enabled: true
})
};
fetch('https://api.ppio.com/v3/glm-tts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ppio.com/v3/glm-tts",
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([
'input' => '<string>',
'speed' => 123,
'voice' => '<string>',
'volume' => 123,
'response_format' => '<string>',
'watermark_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.ppio.com/v3/glm-tts"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123,\n \"response_format\": \"<string>\",\n \"watermark_enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.ppio.com/v3/glm-tts")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"input\": \"<string>\",\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123,\n \"response_format\": \"<string>\",\n \"watermark_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/v3/glm-tts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"input\": \"<string>\",\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123,\n \"response_format\": \"<string>\",\n \"watermark_enabled\": true\n}"
response = http.request(request)
puts response.read_body音频
GLM 语音合成
POST
/
v3
/
glm-tts
GLM 语音合成
curl --request POST \
--url https://api.ppio.com/v3/glm-tts \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"input": "<string>",
"speed": 123,
"voice": "<string>",
"volume": 123,
"response_format": "<string>",
"watermark_enabled": true
}
'import requests
url = "https://api.ppio.com/v3/glm-tts"
payload = {
"input": "<string>",
"speed": 123,
"voice": "<string>",
"volume": 123,
"response_format": "<string>",
"watermark_enabled": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
input: '<string>',
speed: 123,
voice: '<string>',
volume: 123,
response_format: '<string>',
watermark_enabled: true
})
};
fetch('https://api.ppio.com/v3/glm-tts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ppio.com/v3/glm-tts",
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([
'input' => '<string>',
'speed' => 123,
'voice' => '<string>',
'volume' => 123,
'response_format' => '<string>',
'watermark_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.ppio.com/v3/glm-tts"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123,\n \"response_format\": \"<string>\",\n \"watermark_enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.ppio.com/v3/glm-tts")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"input\": \"<string>\",\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123,\n \"response_format\": \"<string>\",\n \"watermark_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/v3/glm-tts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"input\": \"<string>\",\n \"speed\": 123,\n \"voice\": \"<string>\",\n \"volume\": 123,\n \"response_format\": \"<string>\",\n \"watermark_enabled\": true\n}"
response = http.request(request)
puts response.read_body使用 GLM-TTS 将文本转换为自然语音,支持多种声音、情感控制和语调调整。
请求头
枚举值:
application/jsonBearer 身份验证格式,例如:Bearer {{API 密钥}}。
请求体
要转换为语音的文本长度限制:0 - 1024
语速,默认1.0,取值范围[0.5, 2]取值范围:[0.5, 2]
生成音频时使用的音色,支持系统音色以及复刻音色两种类型。系统音色包括:tongtong(彤彤,默认音色)、chuichui(锤锤)、xiaochen(小陈)、jam(动动动物圈jam音色)、kazi(动动动物圈kazi音色)、douji(动动动物圈douji音色)、luodo(动动动物圈luodo音色)
音量,默认1.0,取值范围(0, 10]取值范围:[0, 10]
音频输出格式,默认返回pcm格式的文件可选值:
wav, pcm控制AI生成音频时是否添加水印。true: 默认启用AI生成的显式水印及隐式数字水印,符合政策要求。false: 关闭所有水印,仅对已完成去水印动作的用户生效。
响应
业务处理成功,采样率建议设置为24000 格式:binary最后修改于 2026年1月12日
⌘I