elevenlabs_ttv
A type-safe, async Rust client for the ElevenLabs Text To Voice API. Design a voice via a prompt with simple, Ergonomic API.
Features
- Type-safe & Async: Built with Rust's type system and async/await support
- Builder Pattern: Intuitive, chainable API for configuring TTV requests
- Model Support: Full support for ElevenLabs models (
models::elevenlabs_models::*) - Customizable: Elevanlabs TTV 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 STT: ElevenLabs Speech-to-Text API. ✅
- Elevenlabs TTD: ElevenLabs Text-to-Dialogue API. ✅
- Elevenlabs TTV: ElevenLabs Text-to-Voice API. ✅
- Elevenlabs TTM: ElevenLabs Text-to-Music API. ✅
- Elevenlabs SFX: ElevenLabs Sound Effects API. ✅
- Elevenlabs VC: ElevenLabs Voice Changer API. ✅
- Elevenlabs AUI: ElevenLabs Audio Isolation API. ⏳
- Elevenlabs DUB: ElevenLabs Dubbing API. ⏳
Installation
Add this to your Cargo.toml:
[]
= "0.0.3"
Quick Start
use ;
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 |
|---|---|
ElevenLabsTTVClient::new(String) |
Create client instance, requires API key (String), (required)* |
.design_voice(String) |
Run design voice exec, requires voice_description (String) (required)* |
.output_format(String) |
Output format of the generated audio (optional) |
.model_id(String) |
Model to use for the voice generation. (optional) |
.text(String) |
Text to transform to sample preview. (optional) |
.auto_generate_text(bool) |
Automatically generate a text to transform to sample preview. (optional) |
.loudness(f32) |
Controls the volume level of the generated voice. (optional) |
.seed(u32) |
Our system will make a best effort to sample deterministically (optional) |
.guidance_scale(u32) |
Controls how closely the AI follows the prompt (optional) |
.stream_previews(bool) |
Includes text to voice previews in the response (optional) |
.remixing_session_id(String) |
The remixing session id (optional) |
.remixing_session_iteration_id(String) |
The id of the remixing session iteration (optional) |
.quality(f32) |
Higher quality results in better voice output but less variety (optional) |
.reference_audio_base64(String) |
Reference audio to use for the voice generation (optional) |
.prompt_strength(f32) |
Controls the balance of prompt versus reference audio (optional) |
.execute() |
Run request → design voice (required)* |
| ------------------------------------------ | ---------------------------------------------------------------------------------- |
ElevenLabsTTVClient::new(String) |
Create client instance, requires API key (String), (required)* |
.create_voice(String, String , String) |
Run create voice exec, requires voice_name, voice_description & generated_voice_id as (String) (required)* |
.labels(String) |
Metadata to add to the created voice (optional) |
.played_not_selected_voice_ids(String) |
List of voice ids that the user has played but not selected (optional) |
.execute() |
Run request → create voice (required)* |
Error Handling
The crate uses standard Rust error handling patterns. All async methods return Result types:
match client.design_voice.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.