ElevenLabs TTS (REST)
ElevenLabsTTS is the default ElevenLabs TTS adapter. It streams audio chunks over the HTTP /v1/text-to-speech/{voiceId}/stream endpoint and exposes the same synthesize / synthesizeStream shape as the rest of Patter’s TTS providers.
REST vs WebSocket — when to use which
ElevenLabs ships two streaming transports. Patter wraps both:
Pick REST unless you’ve measured a per-utterance latency problem and confirmed you don’t need
eleven_v3. The REST adapter is the canonical choice and gets every new ElevenLabs model on day one.
Install
ElevenLabsTTS ships in the core getpatter package — no extras needed:
Quickstart
Carrier-tuned factories
For real phone calls always reach for the carrier-specific factories — they pre-set the rightoutputFormat so the SDK can skip resampling and PCM ↔ μ-law transcoding on the audio path:
forTwilio saves ~30–80 ms first-byte plus per-frame CPU and removes a potential aliasing source. If your Telnyx profile is pinned to PCMU/8000 instead, construct directly with outputFormat: "ulaw_8000".
Carrier auto-detect — setTelephonyCarrier
When you don’t know the carrier at construction time, StreamHandler calls setTelephonyCarrier(carrier) at call start to advise the provider of the wire format:
outputFormat was passed explicitly to the constructor (or via forTwilio / forTelnyx), setTelephonyCarrier is a no-op — the user’s choice always wins. Calling with an unknown carrier ("" / "custom") is also a no-op.
Constructor
API surface
synthesizeStream cancels the underlying HTTP stream when the consumer breaks out of the loop, so ElevenLabs stops billing for unconsumed characters.
Models
Exposed as a typed
as const object for autocomplete:
Output formats
Voice ID resolution
Pass either an opaque 20-char ElevenLabs voice ID ("21m00Tcm4TlvDq8ikWAM") or a curated display name. The SDK ships a built-in name → ID map for common voices ("rachel", "bella", "matilda", etc.) plus an "alloy" alias for cross-provider portability with OpenAI naming. Unknown strings are passed through unchanged so custom voices keep working.
Pricing
Pricing is auto-resolved from
DEFAULT_PRICING per model — no override needed unless you’re on a custom ElevenLabs plan. See Metrics for how to register custom rates.
See also
- TTS overview — provider table and shared concepts.
ElevenLabsWebSocketTTS— opt-in low-latency WebSocket variant.ElevenLabsConvAI— managed-agent engine using ElevenLabs end-to-end.

