OpenAI TTS
OpenAITTS is a Patter TTSProvider backed by OpenAI’s POST /v1/audio/speech endpoint. It streams 24 kHz PCM from OpenAI and resamples it to 16 kHz or 8 kHz on the fly so the telephony output path can forward bytes without an additional resample stage. No vendor SDK required.
Install
openai-tts ships in the base install — no extra needed.
On Python 3.13+ install
audioop-lts for the in-process 24 kHz → 16 kHz
(or 8 kHz) resampler. It’s pinned in getpatter’s base dependencies.Usage
Use the namespaced import (
getpatter.tts.openai) or the flat alias
(getpatter.OpenAITTS). Both auto-resolve OPENAI_API_KEY from the
environment when api_key= is omitted.Models and rates
OpenAI TTS bills per 1,000 characters synthesized. Per-model rates (defaults fromgetpatter.pricing):
(
gpt-4o-mini-tts is billed by tokens upstream; published per 1k chars equivalent for parity with the rest of the table. Override per-call via Patter(pricing={"openai_tts": {"models": {"tts-1": {"price": ...}}}}).)
Voices
Built-in voices accepted by all three models:alloy (default), ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse.
Languages
OpenAI TTS automatically follows the language of the input text — nolanguage parameter exists. The same voice can synthesize across most of OpenAI’s supported languages (English, Spanish, French, German, Italian, Portuguese, Japanese, Chinese, …) — see the OpenAI voice guide for the full coverage matrix.
Voice direction (gpt-4o-mini-tts only)
Pass instructions= to steer tone, pacing, and accent:
tts-1 and tts-1-hd reject instructions with a 400 — the SDK silently drops the field for those models so you can swap freely.

