elevenlabs_rs

Crates.ioelevenlabs_rs
lib.rselevenlabs_rs
version0.6.0
created_at2023-08-07 03:28:27.179557+00
updated_at2025-04-05 00:47:48.048429+00
descriptionA lib crate for ElevenLabs
homepage
repositoryhttps://github.com/rwxbytes/elevenlabs_rs
max_upload_size
id937617
size440,115
(rwxbytes)

documentation

README

An unofficial lib crate for ElevenLabs

Text-to-Speech

 use elevenlabs_rs::{ElevenLabsClient, Result, DefaultVoice, Model};
 use elevenlabs_rs::endpoints::genai::tts::{TextToSpeech, TextToSpeechBody};
 use elevenlabs_rs::utils::play;

 #[tokio::main]
 async fn main() -> Result<()> {
     let client = ElevenLabsClient::from_env()?;

     let txt = "Hello! 你好! Hola! नमस्ते! Bonjour! \
         こんにちは! مرحبا! 안녕하세요! Ciao! Cześć! Привіт! வணக்கம்!";

     let body = TextToSpeechBody::new(txt)
        .with_model_id(Model::ElevenMultilingualV2);

     let endpoint = TextToSpeech::new(DefaultVoice::Brian, body);

     let speech = client.hit(endpoint).await?;

     play(speech)?;

     Ok(())
 }
Commit count: 339

cargo fmt