Skip to main content

Crate elevenlabs_ttd

Crate elevenlabs_ttd 

Source
Expand description

ElevenLabs Text-to-Dialogue API client

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

§Quick Start

use elevenlabs_ttd::{ElevenLabsTTDClient, TTDInput, voices};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ElevenLabsTTDClient::new("your-api-key");

     let inputs = vec![
       TTDInput {
           text: "I saw the sky this morning, it looked like fire.".to_string(),
           voice_id: voices::all_voices::ARNOLD.voice_id.to_string(),
       },
       TTDInput {
           text: "I noticed that too, the sunrise was unreal.".to_string(),
           voice_id: voices::all_voices::IVANA.voice_id.to_string(),
       },
    ];
     
    let audio = client
        .text_to_dialogue(inputs)
        .execute()
        .await?;
     
    // audio is Vec<u8> - raw audio data
    std::fs::write("output.mp3", audio)?;
    Ok(())
}

Re-exports§

pub use error::ElevenLabsTTDError;
pub use types::*;

Modules§

error
models
types
voices

Structs§

ElevenLabsTTDClient
Main client for interacting with ElevenLabs API
TextToDialogueBuilder
Builder for Text-to-Dialogue requests