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>,
}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.
Trait Implementations§
Source§impl Clone for SpeechRequest
impl Clone for SpeechRequest
Source§fn clone(&self) -> SpeechRequest
fn clone(&self) -> SpeechRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpeechRequest
impl Debug for SpeechRequest
Source§impl Default for SpeechRequest
impl Default for SpeechRequest
Source§fn default() -> SpeechRequest
fn default() -> SpeechRequest
Returns the “default value” for a type. Read more
Source§impl Post for SpeechRequest
impl Post for SpeechRequest
Source§impl PostBinary for SpeechRequest
impl PostBinary for SpeechRequest
Auto Trait Implementations§
impl Freeze for SpeechRequest
impl RefUnwindSafe for SpeechRequest
impl Send for SpeechRequest
impl Sync for SpeechRequest
impl Unpin for SpeechRequest
impl UnsafeUnpin for SpeechRequest
impl UnwindSafe for SpeechRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more