elevenlabs_ttd
A type-safe, async Rust client for the ElevenLabs Text-to-Dialogue API. Generate high-quality speech from text with a simple, ergonomic API.
Features
- Type-safe & Async: Built with Rust's type system and async/await support
- Builder Pattern: Intuitive, chainable API for configuring TTD requests
- Predefined Voices: Access to static voice definitions (
voices::all_voices::*) - Model Support: Full support for ElevenLabs models (
models::elevenlabs_models::*) - Customizable: Voice settings, Elevanlabs TTD APIs, custom base URLs, and enterprise support
- Tokio Ready: Works seamlessly with the Tokio runtime
Check-out Also:
This project is part of a milestone to implement all ElevenLabs APIs in Rust.
- Elevenlabs TTS: ElevenLabs Text-to-Speech API. ✅
- Elevenlabs TTD: ElevenLabs Text-to-Dialogue API. ✅
- Elevenlabs STT: ElevenLabs Speech-to-Text API. ✅
- Elevenlabs SFX: ElevenLabs Sound Effects API. ✅
- Elevenlabs VC: ElevenLabs Voice Changer API. ✅
- Elevenlabs TTV: ElevenLabs Text-to-Voice API. ⏳
- Elevenlabs CM: ElevenLabs Music Compose API. ⏳
- Elevenlabs AUI: ElevenLabs Audio Isolation API. ⏳
- Elevenlabs DUB: ElevenLabs Dubbing API. ⏳
Installation
Add this to your Cargo.toml:
[]
= "0.0.2"
Quick Start
use ElevenLabsTTDClient;
async
Examples
Basic Usage
use ;
use env;
async
Advanced Configuration
use ;
use env;
async
Running Examples
# Set your API key
# Run the basic example
# Run the advanced example
API Overview
| Method | Description |
|---|---|
ElevenLabsTTDClient::new(String) |
Create client instance (required)* |
.text_to_dialogue(String) |
Build a TTD request (required)* |
.inputs(TTDInput) |
A list of dialogue inputs, each containing text & a voice_id (required)* |
.output_format(String) |
Audio format (e.g. mp3_44100) (optional) |
.model_id(String) |
Only Eleven V3 Family Supported for now (optional) |
.settings(TTDSettings) |
Settings controlling the dialogue generation. (optional) |
.pronunciation_dictionary_locators(TTDPronunciationDictionaryLocators) |
A list of pronunciation dictionary locators (id, version_id) to be applied to the text (optional) |
.seed(u32) |
Deterministic sampling (optional) |
.execute() |
Run request → audio (required)* |
Error Handling
The crate uses standard Rust error handling patterns. All async methods return Result types:
match client.text_to_dialogue.execute.await
Requirements
- Rust 1.70+ (for async/await support)
- Tokio runtime
- Valid ElevenLabs API key
License
Licensed under either of:
at your option.
Contributing
Contributions are welcome! Please feel free to:
- Open issues for bugs or feature requests
- Submit pull requests with improvements
- Improve documentation or examples
- Add tests or benchmarks
Before contributing, please ensure your code follows Rust conventions and includes appropriate tests.
Support
If you like this project, consider supporting me on Patreon 💖
Changelog
See CHANGELOG.md for a detailed history of changes.
Note: This crate is not officially affiliated with ElevenLabs. Please refer to the ElevenLabs API documentation for the most up-to-date API information.