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
This commit is contained in:
@@ -11,17 +11,22 @@ const (
|
|||||||
TTSModel1 SpeechModel = "tts-1"
|
TTSModel1 SpeechModel = "tts-1"
|
||||||
TTSModel1HD SpeechModel = "tts-1-hd"
|
TTSModel1HD SpeechModel = "tts-1-hd"
|
||||||
TTSModelCanary SpeechModel = "canary-tts"
|
TTSModelCanary SpeechModel = "canary-tts"
|
||||||
|
TTSModelGPT4oMini SpeechModel = "gpt-4o-mini-tts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SpeechVoice string
|
type SpeechVoice string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VoiceAlloy SpeechVoice = "alloy"
|
VoiceAlloy SpeechVoice = "alloy"
|
||||||
|
VoiceAsh SpeechVoice = "ash"
|
||||||
|
VoiceBallad SpeechVoice = "ballad"
|
||||||
|
VoiceCoral SpeechVoice = "coral"
|
||||||
VoiceEcho SpeechVoice = "echo"
|
VoiceEcho SpeechVoice = "echo"
|
||||||
VoiceFable SpeechVoice = "fable"
|
VoiceFable SpeechVoice = "fable"
|
||||||
VoiceOnyx SpeechVoice = "onyx"
|
VoiceOnyx SpeechVoice = "onyx"
|
||||||
VoiceNova SpeechVoice = "nova"
|
VoiceNova SpeechVoice = "nova"
|
||||||
VoiceShimmer SpeechVoice = "shimmer"
|
VoiceShimmer SpeechVoice = "shimmer"
|
||||||
|
VoiceVerse SpeechVoice = "verse"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SpeechResponseFormat string
|
type SpeechResponseFormat string
|
||||||
@@ -39,6 +44,7 @@ type CreateSpeechRequest struct {
|
|||||||
Model SpeechModel `json:"model"`
|
Model SpeechModel `json:"model"`
|
||||||
Input string `json:"input"`
|
Input string `json:"input"`
|
||||||
Voice SpeechVoice `json:"voice"`
|
Voice SpeechVoice `json:"voice"`
|
||||||
|
Instructions string `json:"instructions,omitempty"` // Optional, Doesnt work with tts-1 or tts-1-hd.
|
||||||
ResponseFormat SpeechResponseFormat `json:"response_format,omitempty"` // Optional, default to mp3
|
ResponseFormat SpeechResponseFormat `json:"response_format,omitempty"` // Optional, default to mp3
|
||||||
Speed float64 `json:"speed,omitempty"` // Optional, default to 1.0
|
Speed float64 `json:"speed,omitempty"` // Optional, default to 1.0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user