FlowTTS Python SDK
OpenAI-style TTS SDK for Tencent Cloud - Simple, elegant, Python-first
English | 简体中文
FlowTTS is a lightweight Text-to-Speech SDK that wraps Tencent Cloud's TRTC TTS API with an OpenAI-compatible interface. Write elegant code with just a few lines.
✨ Features
- 🎯 OpenAI-Compatible API - Drop-in replacement for OpenAI TTS
- 🐍 Python-First - Designed for Python 3.8+
- 🔷 Type Hints - Full type safety with mypy support
- 🎤 Rich Voice Library - 380+ preset voices in multiple languages
- 🔍 Auto Language Detection - Automatically detects text language
- 📦 Simple Installation - Easy pip install
📦 Installation
pip install flow-tts
🚀 Quick Start
from flow_tts import FlowTTS
client = FlowTTS({
"secret_id": "your-secret-id",
"secret_key": "your-secret-key",
"sdk_app_id": 1234567890
})
# Synthesize speech
response = client.synthesize({
"text": "你好,世界!",
"voice": "v-female-R2s4N9qJ",
"format": "wav"
})
# Save to file
with open("output.wav", "wb") as f:
f.write(response["audio"])
print(f"Generated {len(response['audio'])} bytes")
⚙️ Configuration
Environment Variables
Create a .env file:
TX_SECRET_ID=your-tencent-cloud-secret-id
TX_SECRET_KEY=your-tencent-cloud-secret-key
TRTC_SDK_APP_ID=your-trtc-app-id
Client Options
from flow_tts import FlowTTSConfig
config: FlowTTSConfig = {
"secret_id": "...", # Tencent Cloud Secret ID
"secret_key": "...", # Tencent Cloud Secret Key
"sdk_app_id": 123456, # TRTC SDK App ID
"region": "ap-beijing" # Region (optional)
}
📖 Voice Management
# Get all available voices
voices = client.get_voices()
print(f"Total voices: {len(voices['preset'])}")
# Search voices
gentle_voices = client.search_voices("温柔")
print(f"Found {len(gentle_voices)} gentle voices")
# Get specific voice info
voice = client.get_voice("v-female-R2s4N9qJ")
print(voice["name"]) # "温柔姐姐"
🎤 Voice Selection
The SDK provides 380+ preset voices:
- 77 Turbo voices (low latency)
- 303 Extended voices (high quality)
Recommended Voices
| Voice ID | Name | Language | Features |
|---|---|---|---|
v-female-R2s4N9qJ |
温柔姐姐 | Chinese | Gentle, Warm |
v-male-Bk7vD3xP |
威严霸总 | Chinese | Mature, Steady |
v-female-p9Xy7Q1L |
清晰女旁白 | English | Clear, Professional |
📄 License
MIT License - see LICENSE file
🤝 Contributing
Issues and Pull Requests are welcome!
📮 Links
- GitHub: chicogong/flow-tts
- PyPI: flow-tts (coming soon)
- Node.js SDK: npm/flow-tts
🙏 Acknowledgments
Built on top of Tencent Cloud TRTC TTS API.
Metadata
Release files for flow-tts 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 | |
|---|---|---|---|
| flow_tts-0.1.0.tar.gz | 26.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flow_tts-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.4 kB
Release files / flow_tts-0.1.0.tar.gz
| Download URL | flow_tts-0.1.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d2c12a95dece337c9a351349217f3353ad7fc0e520bbd1660cdb3cd1a3bcc6c
|
|
BLAKE2b-256 checksum How to use checksums |
870750a7a11b43df0472bc0b574bef9ca8d0f7e578ece26cceba764ed1d41d0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.1
|
Release files / flow_tts-0.1.0-py3-none-any.whl
| Download URL | flow_tts-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72f8cb976754be5e80ff6308ab5984e0fc6ba9f05b2eea454b34351b052e33c9
|
|
BLAKE2b-256 checksum How to use checksums |
0f9c6633d417966aaf46f3a824bc2bef61573a7ac8e9f700430bdc546b547a09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.1
|