You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The official Python API for [ElevenLabs](https://elevenlabs.io/)[text-to-speech software.](https://elevenlabs.io/text-to-speech) Eleven brings the most compelling, rich and lifelike voices to creators and developers in just a few lines of code.
11
+
The official Python SDK for [ElevenLabs](https://elevenlabs.io/). ElevenLabs brings the most compelling, rich and lifelike voices to creators and developers in just a few lines of code.
12
12
13
13
## 📖 API & Docs
14
14
15
15
Check out the [HTTP API documentation](https://elevenlabs.io/docs/api-reference).
16
16
17
-
## ⚙️ Install
17
+
## Install
18
18
19
19
```bash
20
20
pip install elevenlabs
21
21
```
22
22
23
-
## 🗣️ Usage
24
-
25
-
[](https://huggingface.co/spaces/elevenlabs/tts)
26
-
[](https://colab.research.google.com/gist/flavioschneider/49468d728a816c6538fd2f56b3b50b96/elevenlabs-python.ipynb)
- Excels in stability, language diversity, and accent accuracy
33
-
- Supports 29 languages
34
-
- Recommended for most use cases
29
+
- Excels in stability, language diversity, and accent accuracy
30
+
- Supports 29 languages
31
+
- Recommended for most use cases
32
+
33
+
2.**Eleven Flash v2.5** (`eleven_flash_v2_5`)
34
+
35
+
- Ultra-low latency
36
+
- Supports 32 languages
37
+
- Faster model, 50% lower price per character
35
38
36
39
2.**Eleven Turbo v2.5** (`eleven_turbo_v2_5`)
37
-
- High quality, lowest latency
38
-
- Ideal for developer use cases where speed is crucial
39
-
- Supports 32 languages
40
40
41
-
For more detailed information about these models and others, visit the [ElevenLabs Models documentation](https://elevenlabs.io/docs/speech-synthesis/models).
41
+
- Good balance of quality and latency
42
+
- Ideal for developer use cases where speed is crucial
43
+
- Supports 32 languages
44
+
45
+
For more detailed information about these models and others, visit the [ElevenLabs Models documentation](https://elevenlabs.io/docs/models).
42
46
43
47
```py
44
48
from dotenv import load_dotenv
@@ -65,7 +69,7 @@ play(audio)
65
69
66
70
</details>
67
71
68
-
## 🗣️ Voices
72
+
## Voices
69
73
70
74
List all your available voices with `voices()`.
71
75
@@ -76,7 +80,7 @@ client = ElevenLabs(
76
80
api_key="YOUR_API_KEY",
77
81
)
78
82
79
-
response = client.voices.get_all()
83
+
response = client.voices.search()
80
84
print(response.voices)
81
85
```
82
86
@@ -96,17 +100,17 @@ from elevenlabs.client import ElevenLabs
Stream text chunks into audio as it's being generated, with <1s latency. Note: if chunks don't end with space or punctuation (" ", ".", "?", "!"), the stream will wait for more text.
138
-
139
-
```py
140
-
from elevenlabs.client import ElevenLabs
141
-
from elevenlabs import stream
142
-
143
-
client = ElevenLabs(
144
-
api_key="YOUR_API_KEY", # Defaults to ELEVENLABS_API_KEY
145
-
)
146
-
147
-
deftext_stream():
148
-
yield"Hi there, I'm Eleven "
149
-
yield"I'm a text to speech API "
150
-
151
-
audio_stream = client.generate(
152
-
text=text_stream(),
153
-
voice="Brian",
154
-
model="eleven_multilingual_v2",
155
-
stream=True
156
-
)
157
-
158
-
stream(audio_stream)
159
-
```
160
-
161
139
## Async Client
162
140
163
141
Use `AsyncElevenLabs` if you want to make API calls asynchronously.
@@ -168,21 +146,19 @@ import asyncio
168
146
from elevenlabs.client import AsyncElevenLabs
169
147
170
148
eleven = AsyncElevenLabs(
171
-
api_key="MY_API_KEY"# Defaults to ELEVENLABS_API_KEY
149
+
api_key="MY_API_KEY"
172
150
)
173
151
174
152
asyncdefprint_models() -> None:
175
-
models =await eleven.models.get_all()
153
+
models =await eleven.models.list()
176
154
print(models)
177
155
178
156
asyncio.run(print_models())
179
157
```
180
158
181
159
## Languages Supported
182
160
183
-
We support 32 languages and 100+ accents. Explore [all languages](https://elevenlabs.io/languages).
0 commit comments