Skip to content

Commit 658beda

Browse files
authored
feat: Add missing TTS models and voices (#958)
* feat: Add missing TTS models and voices * feat: Add new instruction field to create speech request - From docs: Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd. * fix: add canary-tts back to SpeechModel
1 parent d68a683 commit 658beda

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

speech.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,25 @@ import (
88
type SpeechModel string
99

1010
const (
11-
TTSModel1 SpeechModel = "tts-1"
12-
TTSModel1HD SpeechModel = "tts-1-hd"
13-
TTSModelCanary SpeechModel = "canary-tts"
11+
TTSModel1 SpeechModel = "tts-1"
12+
TTSModel1HD SpeechModel = "tts-1-hd"
13+
TTSModelCanary SpeechModel = "canary-tts"
14+
TTSModelGPT4oMini SpeechModel = "gpt-4o-mini-tts"
1415
)
1516

1617
type SpeechVoice string
1718

1819
const (
1920
VoiceAlloy SpeechVoice = "alloy"
21+
VoiceAsh SpeechVoice = "ash"
22+
VoiceBallad SpeechVoice = "ballad"
23+
VoiceCoral SpeechVoice = "coral"
2024
VoiceEcho SpeechVoice = "echo"
2125
VoiceFable SpeechVoice = "fable"
2226
VoiceOnyx SpeechVoice = "onyx"
2327
VoiceNova SpeechVoice = "nova"
2428
VoiceShimmer SpeechVoice = "shimmer"
29+
VoiceVerse SpeechVoice = "verse"
2530
)
2631

2732
type SpeechResponseFormat string
@@ -39,6 +44,7 @@ type CreateSpeechRequest struct {
3944
Model SpeechModel `json:"model"`
4045
Input string `json:"input"`
4146
Voice SpeechVoice `json:"voice"`
47+
Instructions string `json:"instructions,omitempty"` // Optional, Doesnt work with tts-1 or tts-1-hd.
4248
ResponseFormat SpeechResponseFormat `json:"response_format,omitempty"` // Optional, default to mp3
4349
Speed float64 `json:"speed,omitempty"` // Optional, default to 1.0
4450
}

0 commit comments

Comments
 (0)