agentai-audio
Text-to-speech and voice cloning for AgentAI.
SpeechGeneratorspeaks texts and clones voices from your code. OpenAI and ElevenLabs need a voice (a default one or one per request), or the request fails withMissingVoice.- With the
toolboxfeature (on by default),SpeechToolBoxgives an agent thegenerate_speechandlist_voicestools. The model gets only the metadata of the audio as JSON by default (SpeechToolOutput::Metadata), or the audio itself (SpeechToolOutput::Media);with_voiceslimits the voices to an allowlist. No tool clones voices. - Providers in
agentai_audio::provider: OpenAI and compatible servers (OpenAI shuts these speech models down on 2027-01-06), ElevenLabs and oMLX. oMLX clones voices from a sample kept in aVoiceStorethat you give it explicitly (MemoryVoiceStore). - Audio is returned as an
agentaiMediaand can be saved in anyMediaStoragefromagentai_audio::storage, re-exported fromagentai-core. - TLS features as in
agentai:rustls-ring(default),rustls-aws-lc,native-tls,system-proxy.
use ;
// The provider comes from the model name, the API key from `OPENAI_API_KEY`
let generator = new?
.with_default_voice;
let response = generator.generate.await?;
See the speech_generator, speech_tools and clone_voice examples.