| Crates.io | elevenlabs_rs |
| lib.rs | elevenlabs_rs |
| version | 0.6.0 |
| created_at | 2023-08-07 03:28:27.179557+00 |
| updated_at | 2025-04-05 00:47:48.048429+00 |
| description | A lib crate for ElevenLabs |
| homepage | |
| repository | https://github.com/rwxbytes/elevenlabs_rs |
| max_upload_size | |
| id | 937617 |
| size | 440,115 |
An unofficial lib crate for ElevenLabs
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(())
}