chub-dev 0.1.0 → 0.1.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/bin/chub-mcp +2 -0
- package/dist/airtable/docs/database/javascript/DOC.md +1437 -0
- package/dist/airtable/docs/database/python/DOC.md +1735 -0
- package/dist/amplitude/docs/analytics/javascript/DOC.md +1282 -0
- package/dist/amplitude/docs/analytics/python/DOC.md +1199 -0
- package/dist/anthropic/docs/claude-api/javascript/DOC.md +503 -0
- package/dist/anthropic/docs/claude-api/python/DOC.md +389 -0
- package/dist/asana/docs/tasks/DOC.md +1396 -0
- package/dist/assemblyai/docs/transcription/DOC.md +1043 -0
- package/dist/atlassian/docs/confluence/javascript/DOC.md +1347 -0
- package/dist/atlassian/docs/confluence/python/DOC.md +1604 -0
- package/dist/auth0/docs/identity/javascript/DOC.md +968 -0
- package/dist/auth0/docs/identity/python/DOC.md +1199 -0
- package/dist/aws/docs/s3/javascript/DOC.md +1773 -0
- package/dist/aws/docs/s3/python/DOC.md +1807 -0
- package/dist/binance/docs/trading/javascript/DOC.md +1315 -0
- package/dist/binance/docs/trading/python/DOC.md +1454 -0
- package/dist/braintree/docs/gateway/javascript/DOC.md +1278 -0
- package/dist/braintree/docs/gateway/python/DOC.md +1179 -0
- package/dist/chromadb/docs/embeddings-db/javascript/DOC.md +1263 -0
- package/dist/chromadb/docs/embeddings-db/python/DOC.md +1707 -0
- package/dist/clerk/docs/auth/javascript/DOC.md +1220 -0
- package/dist/clerk/docs/auth/python/DOC.md +274 -0
- package/dist/cloudflare/docs/workers/javascript/DOC.md +918 -0
- package/dist/cloudflare/docs/workers/python/DOC.md +994 -0
- package/dist/cockroachdb/docs/distributed-db/DOC.md +1500 -0
- package/dist/cohere/docs/llm/DOC.md +1335 -0
- package/dist/datadog/docs/monitoring/javascript/DOC.md +1740 -0
- package/dist/datadog/docs/monitoring/python/DOC.md +1815 -0
- package/dist/deepgram/docs/speech/javascript/DOC.md +885 -0
- package/dist/deepgram/docs/speech/python/DOC.md +685 -0
- package/dist/deepl/docs/translation/javascript/DOC.md +887 -0
- package/dist/deepl/docs/translation/python/DOC.md +944 -0
- package/dist/deepseek/docs/llm/DOC.md +1220 -0
- package/dist/directus/docs/headless-cms/javascript/DOC.md +1128 -0
- package/dist/directus/docs/headless-cms/python/DOC.md +1276 -0
- package/dist/discord/docs/bot/javascript/DOC.md +1090 -0
- package/dist/discord/docs/bot/python/DOC.md +1130 -0
- package/dist/elasticsearch/docs/search/DOC.md +1634 -0
- package/dist/elevenlabs/docs/text-to-speech/javascript/DOC.md +336 -0
- package/dist/elevenlabs/docs/text-to-speech/python/DOC.md +552 -0
- package/dist/firebase/docs/auth/DOC.md +1015 -0
- package/dist/gemini/docs/genai/javascript/DOC.md +691 -0
- package/dist/gemini/docs/genai/python/DOC.md +555 -0
- package/dist/github/docs/octokit/DOC.md +1560 -0
- package/dist/google/docs/bigquery/javascript/DOC.md +1688 -0
- package/dist/google/docs/bigquery/python/DOC.md +1503 -0
- package/dist/hubspot/docs/crm/javascript/DOC.md +1805 -0
- package/dist/hubspot/docs/crm/python/DOC.md +2033 -0
- package/dist/huggingface/docs/transformers/DOC.md +948 -0
- package/dist/intercom/docs/messaging/javascript/DOC.md +1844 -0
- package/dist/intercom/docs/messaging/python/DOC.md +1797 -0
- package/dist/jira/docs/issues/javascript/DOC.md +1420 -0
- package/dist/jira/docs/issues/python/DOC.md +1492 -0
- package/dist/kafka/docs/streaming/javascript/DOC.md +1671 -0
- package/dist/kafka/docs/streaming/python/DOC.md +1464 -0
- package/dist/landingai-ade/docs/api/DOC.md +620 -0
- package/dist/landingai-ade/docs/sdk/python/DOC.md +489 -0
- package/dist/landingai-ade/docs/sdk/typescript/DOC.md +542 -0
- package/dist/landingai-ade/skills/SKILL.md +489 -0
- package/dist/launchdarkly/docs/feature-flags/javascript/DOC.md +1191 -0
- package/dist/launchdarkly/docs/feature-flags/python/DOC.md +1671 -0
- package/dist/linear/docs/tracker/DOC.md +1554 -0
- package/dist/livekit/docs/realtime/javascript/DOC.md +303 -0
- package/dist/livekit/docs/realtime/python/DOC.md +163 -0
- package/dist/mailchimp/docs/marketing/DOC.md +1420 -0
- package/dist/meilisearch/docs/search/DOC.md +1241 -0
- package/dist/microsoft/docs/onedrive/javascript/DOC.md +1421 -0
- package/dist/microsoft/docs/onedrive/python/DOC.md +1549 -0
- package/dist/mongodb/docs/atlas/DOC.md +2041 -0
- package/dist/notion/docs/workspace-api/javascript/DOC.md +1435 -0
- package/dist/notion/docs/workspace-api/python/DOC.md +1400 -0
- package/dist/okta/docs/identity/javascript/DOC.md +1171 -0
- package/dist/okta/docs/identity/python/DOC.md +1401 -0
- package/dist/openai/docs/chat/javascript/DOC.md +407 -0
- package/dist/openai/docs/chat/python/DOC.md +568 -0
- package/dist/paypal/docs/checkout/DOC.md +278 -0
- package/dist/pinecone/docs/sdk/javascript/DOC.md +984 -0
- package/dist/pinecone/docs/sdk/python/DOC.md +1395 -0
- package/dist/plaid/docs/banking/javascript/DOC.md +1163 -0
- package/dist/plaid/docs/banking/python/DOC.md +1203 -0
- package/dist/playwright-community/skills/login-flows/SKILL.md +108 -0
- package/dist/postmark/docs/transactional-email/DOC.md +1168 -0
- package/dist/prisma/docs/orm/javascript/DOC.md +1419 -0
- package/dist/prisma/docs/orm/python/DOC.md +1317 -0
- package/dist/qdrant/docs/vector-search/javascript/DOC.md +1221 -0
- package/dist/qdrant/docs/vector-search/python/DOC.md +1653 -0
- package/dist/rabbitmq/docs/message-queue/javascript/DOC.md +1193 -0
- package/dist/rabbitmq/docs/message-queue/python/DOC.md +1243 -0
- package/dist/razorpay/docs/payments/javascript/DOC.md +1219 -0
- package/dist/razorpay/docs/payments/python/DOC.md +1330 -0
- package/dist/redis/docs/key-value/javascript/DOC.md +1851 -0
- package/dist/redis/docs/key-value/python/DOC.md +2054 -0
- package/dist/registry.json +2817 -0
- package/dist/replicate/docs/model-hosting/DOC.md +1318 -0
- package/dist/resend/docs/email/DOC.md +1271 -0
- package/dist/salesforce/docs/crm/javascript/DOC.md +1241 -0
- package/dist/salesforce/docs/crm/python/DOC.md +1183 -0
- package/dist/search-index.json +1 -0
- package/dist/sendgrid/docs/email-api/javascript/DOC.md +371 -0
- package/dist/sendgrid/docs/email-api/python/DOC.md +656 -0
- package/dist/sentry/docs/error-tracking/javascript/DOC.md +1073 -0
- package/dist/sentry/docs/error-tracking/python/DOC.md +1309 -0
- package/dist/shopify/docs/storefront/DOC.md +457 -0
- package/dist/slack/docs/workspace/javascript/DOC.md +933 -0
- package/dist/slack/docs/workspace/python/DOC.md +271 -0
- package/dist/square/docs/payments/javascript/DOC.md +1855 -0
- package/dist/square/docs/payments/python/DOC.md +1728 -0
- package/dist/stripe/docs/api/DOC.md +1727 -0
- package/dist/stripe/docs/payments/DOC.md +1726 -0
- package/dist/stytch/docs/auth/javascript/DOC.md +1813 -0
- package/dist/stytch/docs/auth/python/DOC.md +1962 -0
- package/dist/supabase/docs/client/DOC.md +1606 -0
- package/dist/twilio/docs/messaging/python/DOC.md +469 -0
- package/dist/twilio/docs/messaging/typescript/DOC.md +946 -0
- package/dist/vercel/docs/platform/DOC.md +1940 -0
- package/dist/weaviate/docs/vector-db/javascript/DOC.md +1268 -0
- package/dist/weaviate/docs/vector-db/python/DOC.md +1388 -0
- package/dist/zendesk/docs/support/javascript/DOC.md +2150 -0
- package/dist/zendesk/docs/support/python/DOC.md +2297 -0
- package/package.json +22 -6
- package/skills/get-api-docs/SKILL.md +84 -0
- package/src/commands/annotate.js +83 -0
- package/src/commands/build.js +12 -1
- package/src/commands/feedback.js +150 -0
- package/src/commands/get.js +83 -42
- package/src/commands/search.js +7 -0
- package/src/index.js +43 -17
- package/src/lib/analytics.js +90 -0
- package/src/lib/annotations.js +57 -0
- package/src/lib/bm25.js +170 -0
- package/src/lib/cache.js +69 -6
- package/src/lib/config.js +8 -3
- package/src/lib/identity.js +99 -0
- package/src/lib/registry.js +103 -20
- package/src/lib/telemetry.js +86 -0
- package/src/mcp/server.js +177 -0
- package/src/mcp/tools.js +251 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: text-to-speech
|
|
3
|
+
description: "ElevenLabs JS library coding guidelines for text-to-speech, TTS, and audio voice generation"
|
|
4
|
+
metadata:
|
|
5
|
+
languages: "javascript"
|
|
6
|
+
versions: "1.59.0"
|
|
7
|
+
updated-on: "2026-03-02"
|
|
8
|
+
source: maintainer
|
|
9
|
+
tags: "elevenlabs,text-to-speech,tts,audio,voice"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# ElevenLabs JS Library Coding Guidelines (JavaScript/TypeScript)
|
|
13
|
+
|
|
14
|
+
You are an ElevenLabs API coding expert. Help me with writing code using the ElevenLabs API calling the official libraries and SDKs.
|
|
15
|
+
|
|
16
|
+
Please follow the following guidelines when generating code.
|
|
17
|
+
|
|
18
|
+
You can find the official SDK documentation and code samples here:
|
|
19
|
+
https://elevenlabs.io/docs/api-reference
|
|
20
|
+
|
|
21
|
+
## Golden Rule: Use the Correct and Current SDK
|
|
22
|
+
|
|
23
|
+
Always use the official ElevenLabs JS SDK to call the ElevenLabs models and services, which is the standard library for all ElevenLabs API interactions.
|
|
24
|
+
|
|
25
|
+
- **Library Name:** ElevenLabs JS
|
|
26
|
+
- **NPM Package:** `@elevenlabs/elevenlabs-js`
|
|
27
|
+
- **Browser SDK:** `@elevenlabs/client` (for browser applications)
|
|
28
|
+
- **React SDK:** `@elevenlabs/react` (for React applications)
|
|
29
|
+
|
|
30
|
+
**Installation:**
|
|
31
|
+
|
|
32
|
+
- **Correct:** `npm install @elevenlabs/elevenlabs-js`
|
|
33
|
+
- **Correct:** `yarn add @elevenlabs/elevenlabs-js`
|
|
34
|
+
|
|
35
|
+
**APIs and Usage:**
|
|
36
|
+
|
|
37
|
+
- **Correct:** `import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"`
|
|
38
|
+
- **Correct:** `const elevenlabs = new ElevenLabsClient({ apiKey: "YOUR_API_KEY" })`
|
|
39
|
+
- **Correct:** `await elevenlabs.textToSpeech.convert(voiceId, { text: "...", modelId: "..." })`
|
|
40
|
+
- **Correct:** `await elevenlabs.voices.search()`
|
|
41
|
+
|
|
42
|
+
## Initialization and API Key
|
|
43
|
+
|
|
44
|
+
The `@elevenlabs/elevenlabs-js` library requires creating an `ElevenLabsClient` instance for all API calls.
|
|
45
|
+
|
|
46
|
+
- Always use `const elevenlabs = new ElevenLabsClient({})` to create an instance.
|
|
47
|
+
- Set the `ELEVENLABS_API_KEY` environment variable, which will be picked up automatically.
|
|
48
|
+
- Alternatively, pass the API key directly in the constructor.
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
|
|
52
|
+
|
|
53
|
+
// Uses the ELEVENLABS_API_KEY environment variable
|
|
54
|
+
const elevenlabs = new ElevenLabsClient();
|
|
55
|
+
|
|
56
|
+
// Or pass the API key directly
|
|
57
|
+
// const elevenlabs = new ElevenLabsClient({ apiKey: process.env.ELEVENLABS_API_KEY });
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Models
|
|
61
|
+
|
|
62
|
+
By default, use the following models when using ElevenLabs:
|
|
63
|
+
|
|
64
|
+
- **General Use (Stability & Quality):** `eleven_multilingual_v2`
|
|
65
|
+
- Excels in stability, language diversity, and accent accuracy
|
|
66
|
+
- Supports 29 languages
|
|
67
|
+
- Recommended for most use cases
|
|
68
|
+
|
|
69
|
+
- **Ultra-Low Latency:** `eleven_flash_v2_5`
|
|
70
|
+
- Fastest model available
|
|
71
|
+
- Supports 32 languages
|
|
72
|
+
- 50% lower price per character
|
|
73
|
+
|
|
74
|
+
- **Balanced Quality/Latency:** `eleven_turbo_v2_5`
|
|
75
|
+
- Good balance of quality and latency
|
|
76
|
+
- Ideal for developer use cases where speed is crucial
|
|
77
|
+
- Supports 32 languages
|
|
78
|
+
|
|
79
|
+
## Basic Text-to-Speech
|
|
80
|
+
|
|
81
|
+
Here's how to convert text to speech using a voice:
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
import { ElevenLabsClient, play } from "@elevenlabs/elevenlabs-js";
|
|
85
|
+
|
|
86
|
+
const elevenlabs = new ElevenLabsClient({
|
|
87
|
+
apiKey: "YOUR_API_KEY", // Defaults to process.env.ELEVENLABS_API_KEY
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const audio = await elevenlabs.textToSpeech.convert("VOICE_ID", {
|
|
91
|
+
text: "Hello! This is a test of ElevenLabs text-to-speech.",
|
|
92
|
+
modelId: "eleven_multilingual_v2",
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
await play(audio);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Important Note:** elevenlabs-js requires MPV and ffmpeg to play audio locally.
|
|
99
|
+
|
|
100
|
+
## Voices
|
|
101
|
+
|
|
102
|
+
List all available voices and get voice details:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
|
|
106
|
+
|
|
107
|
+
const elevenlabs = new ElevenLabsClient();
|
|
108
|
+
|
|
109
|
+
// List all voices
|
|
110
|
+
const voices = await elevenlabs.voices.search();
|
|
111
|
+
|
|
112
|
+
// Get specific voice details
|
|
113
|
+
const voice = await elevenlabs.voices.get("VOICE_ID");
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Streaming Audio
|
|
117
|
+
|
|
118
|
+
Stream audio in real-time as it's being generated for lower latency:
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
const audioStream = await elevenlabs.textToSpeech.stream("VOICE_ID", {
|
|
122
|
+
text: "This is streaming text-to-speech",
|
|
123
|
+
modelId: "eleven_multilingual_v2",
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Use the stream helper function to play
|
|
127
|
+
await stream(audioStream);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Advanced Configurations
|
|
131
|
+
|
|
132
|
+
### Voice Settings
|
|
133
|
+
|
|
134
|
+
Customize voice parameters by providing voice settings:
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
const audio = await elevenlabs.textToSpeech.convert("VOICE_ID", {
|
|
138
|
+
text: "Custom voice settings example",
|
|
139
|
+
modelId: "eleven_multilingual_v2",
|
|
140
|
+
voiceSettings: {
|
|
141
|
+
stability: 0.5,
|
|
142
|
+
similarityBoost: 0.75
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Output Formats
|
|
148
|
+
|
|
149
|
+
Specify different audio output formats:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
const audio = await elevenlabs.textToSpeech.convert("VOICE_ID", {
|
|
153
|
+
text: "High quality audio example",
|
|
154
|
+
modelId: "eleven_multilingual_v2",
|
|
155
|
+
outputFormat: "mp3_44100_128" // High quality MP3
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Available formats include: `mp3_44100_128`, `pcm_44100`, `opus_48000_128`, and many others.
|
|
160
|
+
|
|
161
|
+
### Text-to-Speech with Timestamps
|
|
162
|
+
|
|
163
|
+
Generate speech with precise character-level timing information:
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const result = await elevenlabs.textToSpeech.convertWithTimestamps("VOICE_ID", {
|
|
167
|
+
text: "This is a test for timing information.",
|
|
168
|
+
modelId: "eleven_multilingual_v2"
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Result contains audioBase64 and alignment data
|
|
172
|
+
console.log(result.audioBase64); // Base64 encoded audio
|
|
173
|
+
console.log(result.alignment); // Timing information
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Language Code Enforcement
|
|
177
|
+
|
|
178
|
+
Enforce specific languages for supported models:
|
|
179
|
+
|
|
180
|
+
```javascript
|
|
181
|
+
const audio = await elevenlabs.textToSpeech.convert("VOICE_ID", {
|
|
182
|
+
text: "Bonjour! Comment allez-vous?",
|
|
183
|
+
modelId: "eleven_turbo_v2_5", // Supports language enforcement
|
|
184
|
+
languageCode: "fr" // French
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Pronunciation Dictionaries
|
|
189
|
+
|
|
190
|
+
Apply pronunciation dictionaries to improve speech accuracy:
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
const audio = await elevenlabs.textToSpeech.convert("VOICE_ID", {
|
|
194
|
+
text: "This text uses custom pronunciations",
|
|
195
|
+
modelId: "eleven_multilingual_v2",
|
|
196
|
+
pronunciationDictionaryLocators: [
|
|
197
|
+
{ pronunciationDictionaryId: "DICT_ID", versionId: "VERSION_ID" }
|
|
198
|
+
]
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Other Capabilities
|
|
203
|
+
|
|
204
|
+
### Speech-to-Speech
|
|
205
|
+
|
|
206
|
+
Convert audio from one voice to another:
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
import * as fs from "fs";
|
|
210
|
+
|
|
211
|
+
const audioFile = fs.readFileSync("input_audio.mp3");
|
|
212
|
+
const audioStream = await elevenlabs.speechToSpeech.convert("TARGET_VOICE_ID", {
|
|
213
|
+
audio: new Blob([audioFile], { type: "audio/mp3" }),
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Text-to-Voice Generation
|
|
218
|
+
|
|
219
|
+
Generate new voices from text descriptions:
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
const previews = await elevenlabs.textToVoice.createPreviews({
|
|
223
|
+
voiceDescription: "A warm and friendly female voice with a slight British accent",
|
|
224
|
+
text: "This is a sample text that is at least one hundred characters long for voice generation."
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Sound Effects Generation
|
|
229
|
+
|
|
230
|
+
Create sound effects from text descriptions:
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
const audioStream = await elevenlabs.textToSoundEffects.convert({
|
|
234
|
+
text: "Thunder and rain sound effect",
|
|
235
|
+
durationSeconds: 5,
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Speech-to-Text
|
|
240
|
+
|
|
241
|
+
Transcribe audio to text:
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
const audioFile = fs.readFileSync("audio.mp3");
|
|
245
|
+
const transcription = await elevenlabs.speechToText.convert({
|
|
246
|
+
file: new Blob([audioFile], { type: "audio/mp3" }),
|
|
247
|
+
modelId: "scribe_v1",
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Audio Isolation
|
|
252
|
+
|
|
253
|
+
Remove background noise from audio:
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
const audioFile = fs.readFileSync("noisy_audio.mp3");
|
|
257
|
+
const cleanAudio = await elevenlabs.audioIsolation.convert({
|
|
258
|
+
audio: new Blob([audioFile], { type: "audio/mp3" }),
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Request Options and Error Handling
|
|
263
|
+
|
|
264
|
+
### Timeouts and Retries
|
|
265
|
+
|
|
266
|
+
Configure request timeouts and retry behavior:
|
|
267
|
+
|
|
268
|
+
```javascript
|
|
269
|
+
const audio = await elevenlabs.textToSpeech.convert(
|
|
270
|
+
"VOICE_ID",
|
|
271
|
+
{
|
|
272
|
+
text: "Hello world",
|
|
273
|
+
modelId: "eleven_multilingual_v2",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
timeoutInSeconds: 30, // Custom timeout
|
|
277
|
+
maxRetries: 3, // Custom retry count
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Error Types
|
|
283
|
+
|
|
284
|
+
The library throws specific error types:
|
|
285
|
+
|
|
286
|
+
- `ElevenLabsError` - General API errors
|
|
287
|
+
- `UnprocessableEntityError` - Validation errors
|
|
288
|
+
- `ElevenLabsTimeoutError` - Timeout errors
|
|
289
|
+
|
|
290
|
+
## Webhooks
|
|
291
|
+
|
|
292
|
+
Handle ElevenLabs webhooks securely:
|
|
293
|
+
|
|
294
|
+
```javascript
|
|
295
|
+
const event = await elevenlabs.webhooks.constructEvent(
|
|
296
|
+
requestBody,
|
|
297
|
+
signatureHeader,
|
|
298
|
+
webhookSecret
|
|
299
|
+
);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Runtime Compatibility
|
|
303
|
+
|
|
304
|
+
The SDK works in multiple JavaScript runtimes:
|
|
305
|
+
|
|
306
|
+
- Node.js 15+
|
|
307
|
+
- Vercel
|
|
308
|
+
- Cloudflare Workers
|
|
309
|
+
- Deno v1.25+
|
|
310
|
+
- Bun 1.0+
|
|
311
|
+
|
|
312
|
+
## API Errors
|
|
313
|
+
|
|
314
|
+
Handle API errors appropriately. The library includes automatic retries for specific HTTP status codes:
|
|
315
|
+
|
|
316
|
+
- 408 (Timeout)
|
|
317
|
+
- 409 (Conflict)
|
|
318
|
+
- 429 (Too Many Requests)
|
|
319
|
+
- 5XX (Internal Server Errors)
|
|
320
|
+
|
|
321
|
+
## Useful Links
|
|
322
|
+
|
|
323
|
+
- Documentation: https://elevenlabs.io/docs/api-reference
|
|
324
|
+
- Models: https://elevenlabs.io/docs/models
|
|
325
|
+
- NPM Package: https://www.npmjs.com/package/@elevenlabs/elevenlabs-js
|
|
326
|
+
- Browser SDK: https://www.npmjs.com/package/@elevenlabs/client
|
|
327
|
+
- React SDK: https://www.npmjs.com/package/@elevenlabs/react
|
|
328
|
+
|
|
329
|
+
## Notes
|
|
330
|
+
|
|
331
|
+
- Always ensure you have valid API keys and sufficient credits
|
|
332
|
+
- For production applications, implement proper error handling and retry logic
|
|
333
|
+
- Consider using streaming for real-time applications to reduce perceived latency
|
|
334
|
+
- The `play` and `stream` functions require FFmpeg and MPV for local audio playback
|
|
335
|
+
- Voice IDs can be obtained from the voices endpoint or the ElevenLabs web interface
|
|
336
|
+
|