tts-api-client
Python-клиент для TTS API — синтез речи в MP3, выбор мужского/женского голоса, сохранение в любую папку.
Установка
pip install tts-api-client
Быстрый старт
from tts_api_client import TTS_API
api = TTS_API("tts_xxxxxxxxxxxxxxxxxxxxxxxx")
# Сохранит в текущую папку → ./voice_message.mp3
path = api.get_voice("Привет, мир!")
print(path)
# Мужской голос + своя папка
api.get_voice("Привет", voice="male", save_dir="cache", filename="hi.mp3")
# Полный путь
api.get_voice("Привет", out_path="/tmp/hello.mp3")
API
TTS_API(token, api_url=DEFAULT_API_URL, user_agent="tts_api_client/1.0", timeout=30)
Создаёт клиент. Токен получается на лендинге твоего TTS API (POST /api/register).
TTS_API.get_voice(...)
| Параметр | Тип | По умолчанию | Описание |
|---|---|---|---|
text |
str |
— | Текст, до 200 символов |
lang |
str |
"ru" |
Язык |
out_path |
Optional[str] |
None |
Полный путь к файлу |
save_dir |
Optional[str] |
None |
Папка (с filename) |
filename |
str |
"voice_message.mp3" |
Имя файла |
voice |
str |
"female" |
female или male |
timeout |
Optional[int] |
None |
Таймаут (переопределяет дефолт) |
Возвращает абсолютный путь к сохранённому MP3.
TTSError
Ловится отдельно. Поле kind — tts_down, tts_invalid или tts_limit.
from tts_api_client import TTS_API, TTSError
try:
TTS_API("tts_xxx").get_voice("Привет")
except TTSError as e:
print(e.kind, e.message)
Лицензия
MIT
Metadata
Release files for tts-api-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tts_api_client-0.1.0.tar.gz | 5.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tts_api_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / tts_api_client-0.1.0.tar.gz
| Download URL | tts_api_client-0.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b132c8099183a7f19e7e1d82d9243b02f95fdf53562b85b4a814baa85a2a5e49
|
|
BLAKE2b-256 checksum How to use checksums |
e9aae75ef863353c52522cbb19bd3ce7ab02b21d6c6bd67acd497ea18ed1a4d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / tts_api_client-0.1.0-py3-none-any.whl
| Download URL | tts_api_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c36977f1019a6d53c62bac156572b348c78199a6b14dfd76fb7fa9e0ed83a12d
|
|
BLAKE2b-256 checksum How to use checksums |
4d0273727129fe74419afdeb41daed6764cb24d1a0a15f5a93f6546bc8867b46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for tts-api-client 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.