Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
GroqTTS
Groq TTS provider: low-latency text-to-speech via Groq’s inference API. Wraps the OpenAI-compatible/openai/v1/audio/speech endpoint served by
Groq. Supports the PlayAI Dialog (playai-tts) and Canopy Labs Orpheus
(canopylabs/orpheus-v1-english, canopylabs/orpheus-arabic-saudi)
model families with streaming WAV output.
Constructor
Groq API key. Falls back to the
GROQ_API_KEY environment variable when None.TTS model identifier. Current options include
"playai-tts" (PlayAI Dialog v1.0, English), "playai-tts-arabic" (PlayAI Dialog v1.0, Arabic), "canopylabs/orpheus-v1-english" (Orpheus English with vocal direction support), and "canopylabs/orpheus-arabic-saudi" (Orpheus Arabic, Saudi dialect). Defaults to "playai-tts".Voice identifier to use for synthesis. For the
playai-tts model, example voices include "Fritz-PlayAI", "Aaliyah-PlayAI", and "Adelaide-PlayAI". For the Orpheus English model, available voices include "troy", "hannah", "austin", "diana", "autumn", and "daniel". Defaults to "Fritz-PlayAI".Speaking speed multiplier. Defaults to
1.0 (normal pace).Audio container format for the returned audio. Defaults to
"wav".Output audio sample rate in Hz. Defaults to
24000.aclose
emit
The event to emit.
interrupt
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.on_first_audio_byte
A callable, optionally async, invoked with synthesis timing information when the first audio byte is emitted.
synthesize
The text to synthesize; coerced to a string if needed.