| name | tts-generation |
| description | AI text-to-speech generation using OpenAI TTS, ElevenLabs, and Google TTS backends. Converts text to audio files with voice selection, speed control, and format options. |
| version | 1.0.0 |
| model | sonnet |
| invoked_by | both |
| user_invocable | true |
| tools | ["Read","Write","Bash","WebFetch"] |
| agents | ["developer","ai-ml-expert"] |
| category | AI/ML |
| tags | ["tts","text-to-speech","audio","openai","elevenlabs","google-tts","voice"] |
| best_practices | ["Choose model tier based on latency vs quality requirements (tts-1 for speed, tts-1-hd for quality)","Cache generated audio files to avoid re-generating identical text","Handle API rate limits with exponential backoff","Validate text length before API call (OpenAI max 4096 chars per request)"] |
| error_handling | strict |
| source | builtin |
| trust_score | 100 |
| provenance_sha | e5bb24bfa4f8179d |
TTS Generation
Overview
Generate speech audio from text using AI backends.
- OpenAI TTS —
tts-1 (low latency) / tts-1-hd (studio quality), 6 voices, 57 languages
- ElevenLabs —
eleven_turbo_v2 / eleven_multilingual_v2, cloneable voices, 29 languages
- Google TTS —
gTTS Python library, 40+ languages, free tier
Backend Comparison
| Feature | OpenAI TTS | ElevenLabs | Google TTS |
|---|
| Quality | High | Highest | Medium |
| Latency | Low (tts-1) | Medium | Low |
| Cost | ~$15/1M chars | ~$22/1M chars | Free (limited) |
| Voices | 6 preset | Cloneable | 40+ languages |
| Max chars | 4096/request | Unlimited | ~5000/request |
| Streaming | Yes | Yes | No |
Quick Start
OpenAI TTS (Recommended)
from pathlib import Path
from openai import OpenAI
client = OpenAI()
response = client.audio.speech.with_streaming_response.create(
model="tts-1-hd",
voice="nova",
input="Hello world",
speed=1.0,
)
response.stream_to_file(Path("output.mp3"))
ElevenLabs
from elevenlabs import ElevenLabs
client = ElevenLabs(api_key="YOUR_API_KEY")
audio = client.text_to_speech.convert(
voice_id=,
model_id=,
text=,
output_format=,
)
(, ) f:
chunk audio:
f.write(chunk)