Text-to-Speech API — Python SDK
Official Python wrapper for the Text-to-Speech API on RapidAPI.
Convert text to natural-sounding speech with 400+ voices in 100+ languages, word-level timestamps, adjustable speed and pitch.
Install
pip install text-to-speech-api
Quick Start
from tts_api import TTSAPI
api = TTSAPI("YOUR_RAPIDAPI_KEY")
# Generate speech
audio = api.tts("Hello, world!")
with open("hello.mp3", "wb") as f:
f.write(audio)
# List French voices
result = api.voices("fr")
for v in result["voices"]:
print(v["name"], v["friendly_name"])
API
TTSAPI(api_key, base_url=None, timeout=30)
api.health() — Health Check
status = api.health()
# {'status': 'ok', 'voices_count': 322, 'version': '1.0.0'}
api.voices(language=None) — List Voices
# All voices
all_voices = api.voices()
# Spanish voices only
spanish = api.voices("es")
api.tts(text, *, voice, rate, pitch, format) — Text to Speech
Returns audio as bytes. Free tier.
audio = api.tts(
"Breaking news from around the world.",
voice="en-US-GuyNeural",
rate="+20%",
format="mp3",
)
with open("news.mp3", "wb") as f:
f.write(audio)
api.tts_with_timestamps(text, *, voice, rate, pitch, format) — TTS + Timestamps
Returns audio as base64 + word-level timing. Basic tier.
result = api.tts_with_timestamps("Five amazing facts about space.")
for word in result["timestamps"]:
print(f"{word['text']} at {word['offset_ms']}ms")
# Decode audio
audio = api.decode_audio(result["audio_base64"])
with open("space.mp3", "wb") as f:
f.write(audio)
Pricing
| Tier | Price | Requests/day | Max chars |
|---|---|---|---|
| Free | $0 | 50 | 1,000 |
| Basic | $3/mo | 500 | 5,000 |
| Pro | $9/mo | 5,000 | 10,000 |
Requirements
- Python 3.8+
- Zero dependencies (uses only stdlib)
License
MIT
Metadata
Release files for rapidapi-tts 1.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 | Actions |
|---|---|---|---|---|
| rapidapi_tts-1.1.0.tar.gz | 6.3 kB | Without provenance | Details for rapidapi_tts-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rapidapi_tts-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for rapidapi_tts-1.1.0-py3-none-any.whl |
Total release size: 13.6 kB
Release files / rapidapi_tts-1.1.0.tar.gz
| Download URL | rapidapi_tts-1.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f9645a734b5e5e6859b91395d63c38af86fe78c1dd9340d068efc7cf48511c8
|
|
BLAKE2b-256 checksum How to use checksums |
64089d96dee1111d2c6397b0836d6b3d9997972f4857635b2ca30f16124a96f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / rapidapi_tts-1.1.0-py3-none-any.whl
| Download URL | rapidapi_tts-1.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d57b057165e8f302488105ecaa54418726aa4a6a827a483c6ee6fd3941c47f85
|
|
BLAKE2b-256 checksum How to use checksums |
479c82c8132bc68993c1a6181eefaceef32240ebd5f1111456ef3fb058ad08cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for rapidapi-tts 1.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.