pub struct OpenAiTts { /* private fields */ }Available on crate feature
audio only.Expand description
OpenAI TTS provider using the /v1/audio/speech endpoint.
Implementations§
Source§impl OpenAiTts
impl OpenAiTts
Sourcepub fn from_env() -> Result<OpenAiTts, AudioError>
Available on crate features qwen3-tts or tts only.
pub fn from_env() -> Result<OpenAiTts, AudioError>
qwen3-tts or tts only.Create from environment variable OPENAI_API_KEY.
Sourcepub fn new(config: CloudTtsConfig) -> OpenAiTts
Available on crate features qwen3-tts or tts only.
pub fn new(config: CloudTtsConfig) -> OpenAiTts
qwen3-tts or tts only.Create with explicit config.
Trait Implementations§
Source§impl TtsProvider for OpenAiTts
impl TtsProvider for OpenAiTts
Source§fn synthesize<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<AudioFrame, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
OpenAiTts: 'async_trait,
fn synthesize<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<AudioFrame, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
OpenAiTts: 'async_trait,
Synthesize text to a single audio frame (batch mode).
Source§fn synthesize_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AudioFrame, AudioError>> + Send>>, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
OpenAiTts: 'async_trait,
fn synthesize_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TtsRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<AudioFrame, AudioError>> + Send>>, AudioError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
OpenAiTts: 'async_trait,
Synthesize text as a stream of audio frames (streaming mode).
Source§fn voice_catalog(&self) -> &[Voice]
fn voice_catalog(&self) -> &[Voice]
List available voices for this provider.
Auto Trait Implementations§
impl !RefUnwindSafe for OpenAiTts
impl !UnwindSafe for OpenAiTts
impl Freeze for OpenAiTts
impl Send for OpenAiTts
impl Sync for OpenAiTts
impl Unpin for OpenAiTts
impl UnsafeUnpin for OpenAiTts
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