Crate elevenlabs_tts

Crate elevenlabs_tts 

Source
Expand description

ElevenLabs Text-to-Speech API client

A type-safe, async Rust client for the ElevenLabs TTS API.

§Quick Start

use elevenlabs_tts::ElevenLabsTTSClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ElevenLabsTTSClient::new("your-api-key");
     
    let audio = client
        .text_to_speech("Hello, world!")
        .voice_id("21m00Tcm4TlvDq8ikWAM") // Rachel voice
        .model("eleven_monolingual_v1")
        .execute()
        .await?;
     
    // audio is Vec<u8> - raw audio data
    std::fs::write("output.mp3", audio)?;
    Ok(())
}

Re-exports§

pub use error::ElevenLabsTTSError;
pub use types::*;

Modules§

error
models
types
voices

Structs§

ElevenLabsTTSClient
Main client for interacting with ElevenLabs API
TextToSpeechBuilder
Builder for text-to-speech requests