From 6e442e8dbab371bb95469562457a30c7c40cb897 Mon Sep 17 00:00:00 2001 From: Richard R Date: Sun, 22 Feb 2026 03:21:27 -0700 Subject: [PATCH] feat: Explicitly set and default TTS response format to MP3. --- src/app/api/tts/route.ts | 4 +++- src/contexts/TTSContext.tsx | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/api/tts/route.ts b/src/app/api/tts/route.ts index 4e97091..3c8cc2e 100644 --- a/src/app/api/tts/route.ts +++ b/src/app/api/tts/route.ts @@ -252,12 +252,14 @@ export async function POST(req: NextRequest) { : voice ) as SpeechCreateParams['voice']; + const resolvedFormat = format || 'mp3'; + const createParams: ExtendedSpeechParams = { model: model, voice: normalizedVoice, input: text, speed: speed, - response_format: format, + response_format: resolvedFormat, }; // Only add instructions if model is gpt-4o-mini-tts and instructions are provided if ((model as string) === 'gpt-4o-mini-tts' && instructions) { diff --git a/src/contexts/TTSContext.tsx b/src/contexts/TTSContext.tsx index b62c402..c2592f8 100644 --- a/src/contexts/TTSContext.tsx +++ b/src/contexts/TTSContext.tsx @@ -1036,6 +1036,7 @@ export function TTSProvider({ children }: { children: ReactNode }): ReactElement text: sentence, voice, speed, + format: 'mp3', model: ttsModel, instructions: ttsModel === 'gpt-4o-mini-tts' ? ttsInstructions : undefined, };