feat: Explicitly set and default TTS response format to MP3.

This commit is contained in:
Richard R 2026-02-22 03:21:27 -07:00
parent f5cd3b262a
commit 6e442e8dba
2 changed files with 4 additions and 1 deletions

View file

@ -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) {

View file

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