diff --git a/examples/audio-text-to-speech/main.go b/examples/audio-text-to-speech/main.go index e432ae99..4b63af57 100644 --- a/examples/audio-text-to-speech/main.go +++ b/examples/audio-text-to-speech/main.go @@ -13,16 +13,18 @@ func main() { ctx := context.Background() res, err := client.Audio.Speech.New(ctx, openai.AudioSpeechNewParams{ - Model: openai.SpeechModelTTS1, + Model: openai.SpeechModelGPT4oMiniTTS, Input: `Why did the chicken cross the road? To get to the other side.`, ResponseFormat: openai.AudioSpeechNewParamsResponseFormatPCM, Voice: openai.AudioSpeechNewParamsVoiceAlloy, }) - defer res.Body.Close() + if err != nil { panic(err) } + defer res.Body.Close() + op := &oto.NewContextOptions{} op.SampleRate = 24000 op.ChannelCount = 1