文字转语音
文字转语音TTS服务,支持142种音色,包括温柔女友、青年音、夹子音等,返回MP3音频链接
GET
https://api.tinyaii.cn/v1/tts
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| action | string | 可选 | voices=音色列表(默认),search=搜索音色,synth=合成语音 | — |
| name | string | 可选 | 搜索音色名称,如 name=女友 | — |
| uid | integer | 可选 | 音色编号(从列表获取),如 uid=6 | — |
| id | string | 可选 | 音色voice_id(可直接使用,跳过uid查找) | — |
| text | string | 可选 | 要转语音的文字(最多500字符),如 text=你好世界 | — |
返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
| text | string | 合成的文字 |
| voice_id | string | 使用的音色ID |
| url | string | MP3音频下载链接 |
| file_id | string | 音频文件ID |
返回示例
{
"code": 200,
"message": "success",
"data": {
"text": "你好世界",
"voice_id": "94515b46345cc63b379bc046f5f88dd6",
"url": "https://dl5.weshineapp.com/text2voice/20260720/1ed36177-3360-44c7-bc4e-3fac191b4596.mp3",
"file_id": "1ed36177-3360-44c7-bc4e-3fac191b4596"
}
}
调用示例
curl "https://api.tinyaii.cn/v1/tts?action=<action>&name=<name>" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://api.tinyaii.cn/v1/tts?action=<action>&name=<name>", {
headers: { "Authorization": "Bearer YOUR_API_KEY" },
});
console.log(await res.json());import requests
resp = requests.get(
"https://api.tinyaii.cn/v1/tts",
params={"action": "<action>", "name": "<name>"},
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=10,
)
print(resp.json())把 YOUR_API_KEY 换成你的密钥即可直接运行。密钥只保存在你自己的设备上。