1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//!<div align="center">
//! <!-- Build -->
//! <img src="https://img.shields.io/github/actions/workflow/status/alexjercan/elevenlabs-api/rust.yml?style=flat-square"
//! alt="Github Worflow Status" />
//! <!-- Version -->
//! <a href="https://crates.io/crates/elevenlabs-api">
//! <img src="https://img.shields.io/crates/v/elevenlabs-api?style=flat-square"
//! alt="Crates.io version" />
//! </a>
//! <!-- Docs -->
//! <a href="https://docs.rs/elevenlabs-api">
//! <img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
//! alt="docs.rs docs" />
//! </a>
//! <!-- Downloads -->
//! <a href="https://crates.io/crates/elevenlabs-api">
//! <img src="https://img.shields.io/crates/d/elevenlabs-api?style=flat-square"
//! alt="Crates.io downloads" />
//! </a>
//! <!-- License -->
//! <a href="https://github.com/alexjercan/elevenlabs-api/blob/master/LICENSE">
//! <img src="https://img.shields.io/github/license/alexjercan/elevenlabs-api?style=flat-square"
//! alt="Crates.io downloads" />
//! </a>
//!</div>
//!
//! A very simple Rust library for Elevenlabs API, free from complex async operations and redundant dependencies. Inspired by [openai-api](https://github.com/openai-rs/openai-api).
//!
//! ## API
//!
//! Check the [official](https://docs.elevenlabs.io/api-reference/quick-start/introduction) API reference.
//!
//! |API|Support|
//! |---|---|
//! |Text to Speech|✔️|
//! |Text to Speech Stream|❌|
//! |Models|❌|
//! |Voices|❌|
//! |Samples|❌|
//! |History|❌|
//! |User|❌|
//!
//! ## Usage
//!
//! Install the library using the Cargo.toml file.
//!
//! Export your API key into the environment variables
//!
//! ```console
//! export ELEVENLABS_API_KEY=...
//! ```
//!
//! Then use the crate in your Rust code:
//!
//! ```no_run
//! # fn main() {
//! // import the dependencies
//! use elevenlabs_api::{
//! tts::{TtsApi, TtsBody},
//! *,
//! };
//!
//! // Load API key from environment ELEVENLABS_API_KEY.
//! // You can also hadcode through `Auth::new(<your_api_key>)`, but it is not recommended.
//! let auth = Auth::from_env().unwrap();
//! let elevenlabs = Elevenlabs::new(auth, "https://api.elevenlabs.io/v1/");
//!
//! // Create the tts body.
//! let tts_body = TtsBody {
//! model_id: None,
//! text: "Hello world".to_string(),
//! voice_settings: None,
//! };
//!
//! // Generate the speech for the text by using the voice with id yoZ06aMxZJJ28mfd3POQ.
//! let tts_result = elevenlabs.tts(&tts_body, "yoZ06aMxZJJ28mfd3POQ");
//! let bytes = tts_result.unwrap();
//!
//! // Do what you need with the bytes.
//! // The server responds with "audio/mpeg" so we can save as mp3.
//! std::fs::write("tts.mp3", bytes).unwrap();
//! # }
//! ```
//!
pub use *;
pub use *;