🗣️泰语文本转语音 V1(Kaitom & Cee 声音)
1 IC每400字符
欢迎使用泰语文本转语音 API V1。此版本通过简单的基于 GET 的 API 提供两种语音选项:
- Kaitom Voice (เสียงน้องไข่ต้ม) - 男声
- Cee Voice (เสียงคุณซี) - 女艺人声音 (@ceemeagain)
试用演示
入门
-
先决条件
- iApp Technology 的 API 密钥
- 泰语和/或英语文本输入
- 最大文本长度:无特定限制
- 支持的输出格式:MP3、WAV
-
快速入门
- 简单的 GET 请求
- 快速处理(小于 1 秒)
- 自然语音生成
- 支持泰语-英语混合文本
-
主要特点
- 自然语音合成
- 混合语言支持(泰语-英语)
- 两种语音选项(Kaitom & Cee)
- 表情符号支持
- 数字、日期和货币价值转换
- 快速处理时间
-
安全与合规
- 符合 GDPR 和 PDPA
- 处理后不保留数据
如何获取 API 密钥?
请访问 API 密钥管理 页面查看您现有的 API 密钥或申请新密钥。
V2 已可用
正在寻找改进的语音质量?尝试使用增强版 Kaitom 语音的 文本转语音 V2
API 端点
| 端点 | 方法 | 描述 | 成本 |
|---|---|---|---|
/v3/store/speech/text-to-speech/kaitom/v1旧版: /thai-tts-kaitom/tts | GET | 泰语 TTS,Kaitom 语音 V1 | 每 400 个字符 1 IC |
/v3/store/speech/text-to-speech/cee旧版: /thai-tts-cee/tts | GET | 泰语 TTS,Cee 语音 | 每 400 个字符 1 IC |
快速示例
Kaitom 语音 V1
请求:
curl --location --request GET 'https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1?text=สวัสดีครับ' \
--header 'apikey: YOUR_API_KEY'
响应:
Cee 语音
请求:
curl --location --request GET 'https://api.iapp.co.th/v3/store/speech/text-to-speech/cee?text=สวัสดีค่ะเสียงซีสังเคราะห์มาแล้วค่ะ' \
--header 'apikey: YOUR_API_KEY'
响应:
备注
用您想要的文本替换 text 参数。输出格式因语音而异:Kaitom 为 MP3,Cee 为 WAV。
API 参考
文本转语音端点(Kaitom V1)
- 端点:
GEThttps://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1 - 必需参数:
apikey:您的 API 密钥(标头)text:要转换为语音的文本(查询参数)
- 输出格式: MP3
文本转语音端点(Cee 语音)
- 端点:
GEThttps://api.iapp.co.th/v3/store/speech/text-to-speech/cee - 必需参数:
apikey:您的 API 密钥(标头)text:要转换为语音的文本(查询参数)
- 输出格式: WAV
代码示例
Python
Kaitom V1
import requests
url = "https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1"
headers = {"apikey": "YOUR_API_KEY"}
params = {"text": "สวัสดีครับ"}
response = requests.get(url, headers=headers, params=params)
with open("output.mp3", "wb") as f:
f.write(response.content)
Cee 语音
import requests
url = "https://api.iapp.co.th/v3/store/speech/text-to-speech/cee"
headers = {"apikey": "YOUR_API_KEY"}
params = {"text": "สวัสดีค่ะ"}
response = requests.get(url, headers=headers, params=params)
with open("output.wav", "wb") as f:
f.write(response.content)
JavaScript (Node.js)
Kaitom V1
const axios = require("axios")
const fs = require("fs")
let config = {
method: "get",
url: "https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1",
params: { text: "สวัสดีครับ" },
headers: { apikey: "YOUR_API_KEY" },
responseType: "arraybuffer",
}
axios(config)
.then((response) => {
fs.writeFileSync("output.mp3", response.data)
})
.catch((error) => console.log(error))
Cee 语音
const axios = require("axios")
const fs = require("fs")
let config = {
method: "get",
url: "https://api.iapp.co.th/v3/store/speech/text-to-speech/cee",
params: { text: "สวัสดีค่ะ" },
headers: { apikey: "YOUR_API_KEY" },
responseType: "arraybuffer",
}
axios(config)
.then((response) => {
fs.writeFileSync("output.wav", response.data)
})
.catch((error) => console.log(error))
PHP
Kaitom V1
<?php
$url = "https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1?text=สวัสดีครับ";
$headers = array('apikey: YOUR_API_KEY');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
file_put_contents("output.mp3", $response);
curl_close($ch);
?>
Cee 语音
<?php
$url = "https://api.iapp.co.th/v3/store/speech/text-to-speech/cee?text=สวัสดีค่ะ";
$headers = array('apikey: YOUR_API_KEY');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
file_put_contents("output.wav", $response);
curl_close($ch);
?>
Swift
import Foundation
let url = URL(string: "https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1?text=สวัสดีครับ&apikey=YOUR_API_KEY")!
var request = URLRequest(url: url, timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("Error:", String(describing: error))
return
}
// Save the data to an MP3 file
let fileManager = FileManager.default
let outputPath = fileManager.temporaryDirectory.appendingPathComponent("output.mp3")
do {
try data.write(to: outputPath)
print("Audio file saved to:", outputPath.path)
} catch {
print("Failed to save file:", error)
}
}
task.resume()
Kotlin
import okhttp3.OkHttpClient
import okhttp3.Request
import java.io.File
import java.io.FileOutputStream
fun main() {
val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1?text=สวัสดีครับ&apikey=YOUR_API_KEY")
.build()
val response = client.newCall(request).execute()
if (response.isSuccessful) {
// Get response body as bytes
val responseBody = response.body?.bytes()
if (responseBody != null) {
// Save to a file
val outputFile = File("output.mp3")
FileOutputStream(outputFile).use { fos ->
fos.write(responseBody)
println("Audio file saved to: ${outputFile.absolutePath}")
}
} else {
println("Response body is empty.")
}
} else {
println("Request failed with status code: ${response.code}")
}
}
Java
import okhttp3.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1?text=สวัสดีครับ&apikey=YOUR_API_KEY")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
// Get the response body as bytes
byte[] responseBody = response.body().bytes();
// Save the response to a file
File outputFile = new File("output.mp3");
try (FileOutputStream fos = new FileOutputStream(outputFile)) {
fos.write(responseBody);
System.out.println("Audio file saved to: " + outputFile.getAbsolutePath());
} catch (IOException e) {
System.err.println("Failed to save the file: " + e.getMessage());
}
} else {
System.err.println("Request failed with status code: " + response.code());
}
// Close the response
response.close();
}
}
Dart
import 'dart:io';
import 'package:http/http.dart' as http;
void main() async {
// Create the GET request
var request = http.Request(
'GET',
Uri.parse(
'https://api.iapp.co.th/v3/store/speech/text-to-speech/kaitom/v1?text=สวัสดีครับ&apikey=YOUR_API_KEY'),
);
// Send the request
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
// Save the response to a file
final file = File('output.mp3');
final bytes = await response.stream.toBytes();
await file.writeAsBytes(bytes);
print('Audio file saved to: ${file.path}');
} else {
print('Request failed: ${response.reasonPhrase}');
}
}
功能与能力
核心功能
- 自然语音生成
- 泰语-英语混合文本支持
- 两种语音选项
- 表情符号转换
- 数字和日期格式化
- 快速处理
语音选项
| 语音 | 性别 | 描述 | 输出格式 |
|---|---|---|---|
| Kaitom V1 | 男 | 小男孩的声音(น้องไข่ต้ม) | MP3 |
| Cee | 女 | 艺人的声音(@ceemeagain ฉัตรปวีณ์ ตรีชัชวาลวงศ์) | WAV |
支持的字段
- 泰语文本
- 英语文本
- 表情符号
- 数字
- 日期
- 货币价值