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, };