Skip to main content

OpenAI-style TTS SDK for Tencent Cloud - Zero dependencies, Python-first

Project description

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

🙏 Acknowledgments

Built on top of Tencent Cloud TRTC TTS API.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flow_tts-0.1.0.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flow_tts-0.1.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file flow_tts-0.1.0.tar.gz.

File metadata

  • Download URL: flow_tts-0.1.0.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for flow_tts-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d2c12a95dece337c9a351349217f3353ad7fc0e520bbd1660cdb3cd1a3bcc6c
MD5 f5479930cabbe182c6354a06be844833
BLAKE2b-256 870750a7a11b43df0472bc0b574bef9ca8d0f7e578ece26cceba764ed1d41d0e

See more details on using hashes here.

File details

Details for the file flow_tts-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flow_tts-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.1

File hashes

Hashes for flow_tts-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72f8cb976754be5e80ff6308ab5984e0fc6ba9f05b2eea454b34351b052e33c9
MD5 6459d386eced14f7022632ca0f7ad0c1
BLAKE2b-256 0f9c6633d417966aaf46f3a824bc2bef61573a7ac8e9f700430bdc546b547a09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page