返回首页

【语音】文字转语音

浏览: 24660 最后更新: 2025-08-02 11:02:10

接口说明

【语音】文字转语音

接口基本信息

API地址

https://api-v1.cenguigui.cn/api/speech/AiChat/

请求方式

GET

返回格式

JSON

接口状态

正常启用

参数说明

以下参数为接口所需调用信息

参数 是否必填 类型 说明 示例
text需要转成语言的文字,默认无
voice音色,默认曼波

请求示例

HTTP请求

https://api-v1.cenguigui.cn/api/speech/AiChat/?module=audio&text=人人都看不起我,偏偏我也不挣钱!&voice=曼波

调用示例

代码示例

音色列表:
https://api-v1.cenguigui.cn/api/speech/AiChat/

返回结果

HTTP 200 OK
{
    "code": 200,
    "message": "生成音频成功",
    "task_id": "ts-578098834777846559",
    "data": {
        "audio_url": "https://jssz-boss.hdslb.com/tts-outputs/2025080210/ppl-ts-578098834777846559-0/audio.wav?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=pVUTcPmnbwM5lW8g%2F20250802%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250802T025559Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=93d13c311bb800f1d94212b1bd5b08a76da5926310a3e4bd8a47dd259767a3f1",
        "meta_url": "https://jssz-boss.hdslb.com/tts-outputs/2025080210/ppl-ts-578098834777846559-0/meta.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=pVUTcPmnbwM5lW8g%2F20250802%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250802T025559Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=04448b2d52a2e5fd8e6ab613eab4042a13a2ffcad81ef5792effbfcb5ed86da8",
        "sep_url": "https://jssz-boss.hdslb.com/tts-outputs/2025080210/ppl-ts-578098834777846559-0/meta.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=pVUTcPmnbwM5lW8g%2F20250802%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250802T025559Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=04448b2d52a2e5fd8e6ab613eab4042a13a2ffcad81ef5792effbfcb5ed86da8"
    },
    "time": "2025-08-02 10:55:59"
}

调用示例

// JavaScript调用示例
fetch("https://api-v1.cenguigui.cn/api/speech/AiChat/?module=audio&text=人人都看不起我,偏偏我也不挣钱!&voice=曼波", {
  method: "GET",
  headers: {
    "Content-Type": "application/json"
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
# Python调用示例
import requests

url = "https://api-v1.cenguigui.cn/api/speech/AiChat/?module=audio&text=人人都看不起我,偏偏我也不挣钱!&voice=曼波"

response = requests.get(url)

print(response.json())
// Java调用示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class ApiExample {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
                .version(HttpClient.Version.HTTP_2)
                .connectTimeout(Duration.ofSeconds(10))
                .build();
                
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api-v1.cenguigui.cn/api/speech/AiChat/?module=audio&text=人人都看不起我,偏偏我也不挣钱!&voice=曼波"))
                .build();
                
        client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
                .thenApply(HttpResponse::body)
                .thenAccept(System.out::println)
                .join();
    }
}
<?php
// PHP调用示例
$url = "https://api-v1.cenguigui.cn/api/speech/AiChat/?module=audio&text=人人都看不起我,偏偏我也不挣钱!&voice=曼波";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
// C#调用示例
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        var url = "https://api-v1.cenguigui.cn/api/speech/AiChat/?module=audio&text=人人都看不起我,偏偏我也不挣钱!&voice=曼波";
        
        var response = await client.GetAsync(url);
        
        var result = await response.Content.ReadAsStringAsync();
        Console.WriteLine(result);
    }
}