pub struct SpeechRequest {
pub input: String,
pub model: String,
pub voice: SpeechVoice,
pub instructions: Option<String>,
pub response_format: Option<SpeechFormat>,
pub speed: Option<f32>,
pub stream_format: Option<SpeechStreamFormat>,
}Expand description
Generates audio from the input text.
Fields§
§input: StringThe text to generate audio for. The maximum length is 4096 characters.
model: StringOne of the available TTS models: tts-1, tts-1-hd,
gpt-4o-mini-tts, or gpt-4o-mini-tts-2025-12-15.
voice: SpeechVoiceThe voice to use when generating the audio.
Supported built-in voices are alloy, ash, ballad, coral,
echo, fable, onyx, nova, sage, shimmer, verse, marin,
and cedar. A custom voice object with an id may also be
provided, for example { "id": "voice_1234" }.
instructions: Option<String>Control the voice of your generated audio with additional
instructions. Does not work with tts-1 or tts-1-hd.
response_format: Option<SpeechFormat>The format to audio in. Supported formats are mp3, opus, aac,
flac, wav, and pcm.
speed: Option<f32>The speed of the generated audio. Select a value from 0.25 to
4.0. 1.0 is the default.
stream_format: Option<SpeechStreamFormat>The format to stream the audio in. Supported formats are sse and
audio. sse is not supported for tts-1 or tts-1-hd.
When set, send the request through
PostBinary::get_stream_response_bytes to receive the response as
a stream of byte chunks instead of a single buffered body.
Trait Implementations§
Source§impl Clone for SpeechRequest
impl Clone for SpeechRequest
Source§fn clone(&self) -> SpeechRequest
fn clone(&self) -> SpeechRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more