8 unstable releases (3 breaking)
new 0.4.1 | Feb 6, 2025 |
---|---|
0.4.0 | Feb 6, 2025 |
0.3.2 | Nov 3, 2024 |
0.3.1 | Jul 11, 2024 |
0.1.1 | Aug 8, 2023 |
#265 in Audio
272 downloads per month
Used in 2 crates
300KB
6.5K
SLoC
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(())
}
lib.rs
:
An unofficial lib crate for ElevenLabs.
Example
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(())
}
Dependencies
~8–42MB
~681K SLoC