#22618: feat(tts): add OpenAI TTS speed parameter support
size: XS
Cluster:
Voice Call and TTS Improvements
Adds support for the speed parameter when using OpenAI TTS provider.
The OpenAI TTS API supports a speed field (0.25–4.0) but it was never passed through — the parameter was silently dropped even when set via config or [[tts:speed=X]] directive.
**Changes:**
- ResolvedTtsConfig.openai + TtsDirectiveOverrides.openai: add speed field
- Zod config schema: messages.tts.openai.speed (0.25–4.0, optional)
- esolveTtsConfig(): read aw.openai?.speed, default 1
- openaiTTS() in ts-core.ts: accept speed param, include in API body
- extToSpeech() + telephony path: pass speed through
- parseTtsDirectives(): [[tts:speed=X]] now sets OpenAI speed alongside ElevenLabs
Closes #12163
> Replaces #12177 (branch was accidentally deleted during rebase attempt)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds OpenAI TTS speed parameter support (0.25–4.0) across config schema, type definitions, and runtime execution paths. The implementation correctly defaults to 1.0, validates config values, passes speed through both `textToSpeech()` and `textToSpeechTelephony()`, and only includes speed in the API request when it differs from the default (avoiding unnecessary API payload).
- Config schema validation added with correct OpenAI range (0.25–4.0)
- `ResolvedTtsConfig.openai.speed` and `TtsDirectiveOverrides.openai.speed` typed correctly
- `resolveTtsConfig()` defaults to 1 when not specified
- `openaiTTS()` accepts optional speed, conditionally includes in API body
- `textToSpeech()` and `textToSpeechTelephony()` both pass speed to OpenAI
- `[[tts:speed=X]]` directive now sets both ElevenLabs and OpenAI speed (constrained to 0.5–2.0 for consistency)
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The implementation is clean, follows existing patterns, adds proper type safety, includes appropriate validation, and only extends functionality without breaking changes. The speed parameter defaults to 1.0 (OpenAI's default), is properly typed throughout, and correctly passes through all code paths. The only consideration is a minor design choice about directive range constraints.
- No files require special attention
<sub>Last reviewed commit: a6f1cd2</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#19210: feat(tts): add OpenAI instructions parameter support
by keenranger · 2026-02-17
79.0%
#6677: fix(tts): always load fresh config for voice selection
by Jinqiao · 2026-02-01
77.0%
#16089: fix(tts): clarify directive syntax in prompts and strip malformed tags
by kmixter · 2026-02-14
76.1%
#22086: fix(tts): honor explicit config provider and model/voice settings
by AIflow-Labs · 2026-02-20
75.8%
#7965: feat(tts): add Speechify as TTS provider
by chaerla · 2026-02-03
75.5%
#9736: feat(tts): add baseUrl option to OpenAI TTS config (#9709)
by divol89 · 2026-02-05
73.4%
#7258: feat(tts): add Inworld AI TTS provider
by willsinghwilson · 2026-02-02
73.1%
#21110: fix(tts): deliver audio via structured mediaUrl instead of MEDIA: t...
by hydro13 · 2026-02-19
72.5%
#15397: feat: support Anthropic speed:"fast" parameter passthrough
by mode80 · 2026-02-13
72.5%
#8317: fix(tts): add dynamic timeout and retry logic for ElevenLabs TTS
by camtang26 · 2026-02-03
72.3%