@runapi.ai/elevenlabs 0.2.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Elevenlabs API JavaScript SDK for RunAPI
2
+
3
+ The elevenlabs api JavaScript SDK is the language-specific package for ElevenLabs on RunAPI. Use this elevenlabs api package for voice, dialogue, transcription, sound effect, and cleanup flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
4
+
5
+ This elevenlabs api README is the JavaScript package guide inside the public `elevenlabs-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/elevenlabs; for API reference, use https://runapi.ai/docs#elevenlabs; for SDK docs, use https://runapi.ai/docs#sdk-elevenlabs.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @runapi.ai/elevenlabs
11
+ ```
12
+
13
+ ## Quick start
14
+
15
+ ```typescript
16
+ import { ElevenLabsClient } from '@runapi.ai/elevenlabs';
17
+
18
+ const client = new ElevenLabsClient();
19
+ const task = await client.speeches.create({
20
+ // Pass the ElevenLabs JSON request body from https://runapi.ai/docs#elevenlabs.
21
+ });
22
+ const status = await client.speeches.get(task.id);
23
+ ```
24
+
25
+ Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
26
+
27
+ ## Language notes
28
+
29
+ Use the TypeScript types in `src/types.ts` and the resource classes under `src/resources` when building audio applications. The available resources include speeches, dialogues, sound effects, transcriptions, and audio isolations. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
30
+
31
+ ## Links
32
+
33
+ - Model page: https://runapi.ai/models/elevenlabs
34
+ - SDK docs: https://runapi.ai/docs#sdk-elevenlabs
35
+ - Product docs: https://runapi.ai/docs#elevenlabs
36
+ - Pricing and rate limits: https://runapi.ai/models/elevenlabs/text-to-speech-turbo-v2.5
37
+ - Provider comparison: https://runapi.ai/providers/elevenlabs
38
+ - Full catalog: https://runapi.ai/models
39
+ - Repository: https://github.com/runapi-ai/elevenlabs-sdk
40
+
41
+ ## License
42
+
43
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,133 @@
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
2
+ export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
+
4
+ type ElevenlabsSpeechModel = 'text-to-speech-turbo-2-5' | 'text-to-speech-multilingual-v2';
5
+ type ElevenlabsSoundEffectOutputFormat = 'mp3_22050_32' | 'mp3_44100_32' | 'mp3_44100_64' | 'mp3_44100_96' | 'mp3_44100_128' | 'mp3_44100_192' | 'pcm_8000' | 'pcm_16000' | 'pcm_22050' | 'pcm_24000' | 'pcm_44100' | 'pcm_48000' | 'ulaw_8000' | 'alaw_8000' | 'opus_48000_32' | 'opus_48000_64' | 'opus_48000_96' | 'opus_48000_128' | 'opus_48000_192';
6
+ interface TaskCreateResponse {
7
+ id: string;
8
+ status?: AsyncTaskStatus;
9
+ }
10
+ interface AudioFile {
11
+ url: string;
12
+ }
13
+ interface AudioTaskResponse {
14
+ id: string;
15
+ status: AsyncTaskStatus;
16
+ audios?: AudioFile[];
17
+ error?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ interface TextToSpeechParams {
21
+ model: ElevenlabsSpeechModel;
22
+ text: string;
23
+ voice?: string;
24
+ callback_url?: string;
25
+ stability?: number;
26
+ similarity_boost?: number;
27
+ style?: number;
28
+ speed?: number;
29
+ timestamps?: boolean;
30
+ previous_text?: string;
31
+ next_text?: string;
32
+ language_code?: string;
33
+ }
34
+ interface DialogueLine {
35
+ text: string;
36
+ voice: string;
37
+ }
38
+ interface TextToDialogueParams {
39
+ dialogue: DialogueLine[];
40
+ callback_url?: string;
41
+ stability?: 0 | 0.5 | 1;
42
+ language_code?: string;
43
+ }
44
+ interface TextToSoundParams {
45
+ text: string;
46
+ callback_url?: string;
47
+ loop?: boolean;
48
+ duration_seconds?: number;
49
+ prompt_influence?: number;
50
+ output_format?: ElevenlabsSoundEffectOutputFormat;
51
+ }
52
+ interface SpeechToTextParams {
53
+ audio_url: string;
54
+ callback_url?: string;
55
+ language_code?: string;
56
+ tag_audio_events?: boolean;
57
+ diarize?: boolean;
58
+ }
59
+ interface SpeechToTextResponse {
60
+ id: string;
61
+ status: AsyncTaskStatus;
62
+ text?: string;
63
+ error?: string;
64
+ [key: string]: unknown;
65
+ }
66
+ interface IsolateAudioParams {
67
+ audio_url: string;
68
+ callback_url?: string;
69
+ }
70
+ /**
71
+ * Resolved responses returned by the `run()` methods after polling sees
72
+ * `status: 'completed'`. Narrows the base response so result fields
73
+ * (`audios` / `text`) are guaranteed non-optional in user code.
74
+ */
75
+ type CompletedAudioTaskResponse = AudioTaskResponse & {
76
+ status: 'completed';
77
+ audios: AudioFile[];
78
+ };
79
+ type CompletedSpeechToTextResponse = SpeechToTextResponse & {
80
+ status: 'completed';
81
+ text: string;
82
+ };
83
+
84
+ declare class TextToSpeech {
85
+ private readonly http;
86
+ constructor(http: HttpClient);
87
+ run(params: TextToSpeechParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
88
+ create(params: TextToSpeechParams, options?: RequestOptions): Promise<TaskCreateResponse>;
89
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
90
+ }
91
+
92
+ declare class TextToDialogue {
93
+ private readonly http;
94
+ constructor(http: HttpClient);
95
+ run(params: TextToDialogueParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
96
+ create(params: TextToDialogueParams, options?: RequestOptions): Promise<TaskCreateResponse>;
97
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
98
+ }
99
+
100
+ declare class TextToSound {
101
+ private readonly http;
102
+ constructor(http: HttpClient);
103
+ run(params: TextToSoundParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
104
+ create(params: TextToSoundParams, options?: RequestOptions): Promise<TaskCreateResponse>;
105
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
106
+ }
107
+
108
+ declare class SpeechToText {
109
+ private readonly http;
110
+ constructor(http: HttpClient);
111
+ run(params: SpeechToTextParams, options?: RequestOptions & PollingOptions): Promise<CompletedSpeechToTextResponse>;
112
+ create(params: SpeechToTextParams, options?: RequestOptions): Promise<TaskCreateResponse>;
113
+ get(id: string, options?: RequestOptions): Promise<SpeechToTextResponse>;
114
+ }
115
+
116
+ declare class IsolateAudio {
117
+ private readonly http;
118
+ constructor(http: HttpClient);
119
+ run(params: IsolateAudioParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
120
+ create(params: IsolateAudioParams, options?: RequestOptions): Promise<TaskCreateResponse>;
121
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
122
+ }
123
+
124
+ declare class ElevenlabsClient {
125
+ readonly textToSpeech: TextToSpeech;
126
+ readonly textToDialogue: TextToDialogue;
127
+ readonly textToSound: TextToSound;
128
+ readonly speechToText: SpeechToText;
129
+ readonly isolateAudio: IsolateAudio;
130
+ constructor(options?: ClientOptions);
131
+ }
132
+
133
+ export { type AudioFile, type AudioTaskResponse, type CompletedAudioTaskResponse, type CompletedSpeechToTextResponse, type DialogueLine, ElevenlabsClient, type ElevenlabsSoundEffectOutputFormat, type ElevenlabsSpeechModel, type IsolateAudioParams, type SpeechToTextParams, type SpeechToTextResponse, type TaskCreateResponse, type TextToDialogueParams, type TextToSoundParams, type TextToSpeechParams };
@@ -0,0 +1,133 @@
1
+ import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
2
+ export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
+
4
+ type ElevenlabsSpeechModel = 'text-to-speech-turbo-2-5' | 'text-to-speech-multilingual-v2';
5
+ type ElevenlabsSoundEffectOutputFormat = 'mp3_22050_32' | 'mp3_44100_32' | 'mp3_44100_64' | 'mp3_44100_96' | 'mp3_44100_128' | 'mp3_44100_192' | 'pcm_8000' | 'pcm_16000' | 'pcm_22050' | 'pcm_24000' | 'pcm_44100' | 'pcm_48000' | 'ulaw_8000' | 'alaw_8000' | 'opus_48000_32' | 'opus_48000_64' | 'opus_48000_96' | 'opus_48000_128' | 'opus_48000_192';
6
+ interface TaskCreateResponse {
7
+ id: string;
8
+ status?: AsyncTaskStatus;
9
+ }
10
+ interface AudioFile {
11
+ url: string;
12
+ }
13
+ interface AudioTaskResponse {
14
+ id: string;
15
+ status: AsyncTaskStatus;
16
+ audios?: AudioFile[];
17
+ error?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ interface TextToSpeechParams {
21
+ model: ElevenlabsSpeechModel;
22
+ text: string;
23
+ voice?: string;
24
+ callback_url?: string;
25
+ stability?: number;
26
+ similarity_boost?: number;
27
+ style?: number;
28
+ speed?: number;
29
+ timestamps?: boolean;
30
+ previous_text?: string;
31
+ next_text?: string;
32
+ language_code?: string;
33
+ }
34
+ interface DialogueLine {
35
+ text: string;
36
+ voice: string;
37
+ }
38
+ interface TextToDialogueParams {
39
+ dialogue: DialogueLine[];
40
+ callback_url?: string;
41
+ stability?: 0 | 0.5 | 1;
42
+ language_code?: string;
43
+ }
44
+ interface TextToSoundParams {
45
+ text: string;
46
+ callback_url?: string;
47
+ loop?: boolean;
48
+ duration_seconds?: number;
49
+ prompt_influence?: number;
50
+ output_format?: ElevenlabsSoundEffectOutputFormat;
51
+ }
52
+ interface SpeechToTextParams {
53
+ audio_url: string;
54
+ callback_url?: string;
55
+ language_code?: string;
56
+ tag_audio_events?: boolean;
57
+ diarize?: boolean;
58
+ }
59
+ interface SpeechToTextResponse {
60
+ id: string;
61
+ status: AsyncTaskStatus;
62
+ text?: string;
63
+ error?: string;
64
+ [key: string]: unknown;
65
+ }
66
+ interface IsolateAudioParams {
67
+ audio_url: string;
68
+ callback_url?: string;
69
+ }
70
+ /**
71
+ * Resolved responses returned by the `run()` methods after polling sees
72
+ * `status: 'completed'`. Narrows the base response so result fields
73
+ * (`audios` / `text`) are guaranteed non-optional in user code.
74
+ */
75
+ type CompletedAudioTaskResponse = AudioTaskResponse & {
76
+ status: 'completed';
77
+ audios: AudioFile[];
78
+ };
79
+ type CompletedSpeechToTextResponse = SpeechToTextResponse & {
80
+ status: 'completed';
81
+ text: string;
82
+ };
83
+
84
+ declare class TextToSpeech {
85
+ private readonly http;
86
+ constructor(http: HttpClient);
87
+ run(params: TextToSpeechParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
88
+ create(params: TextToSpeechParams, options?: RequestOptions): Promise<TaskCreateResponse>;
89
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
90
+ }
91
+
92
+ declare class TextToDialogue {
93
+ private readonly http;
94
+ constructor(http: HttpClient);
95
+ run(params: TextToDialogueParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
96
+ create(params: TextToDialogueParams, options?: RequestOptions): Promise<TaskCreateResponse>;
97
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
98
+ }
99
+
100
+ declare class TextToSound {
101
+ private readonly http;
102
+ constructor(http: HttpClient);
103
+ run(params: TextToSoundParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
104
+ create(params: TextToSoundParams, options?: RequestOptions): Promise<TaskCreateResponse>;
105
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
106
+ }
107
+
108
+ declare class SpeechToText {
109
+ private readonly http;
110
+ constructor(http: HttpClient);
111
+ run(params: SpeechToTextParams, options?: RequestOptions & PollingOptions): Promise<CompletedSpeechToTextResponse>;
112
+ create(params: SpeechToTextParams, options?: RequestOptions): Promise<TaskCreateResponse>;
113
+ get(id: string, options?: RequestOptions): Promise<SpeechToTextResponse>;
114
+ }
115
+
116
+ declare class IsolateAudio {
117
+ private readonly http;
118
+ constructor(http: HttpClient);
119
+ run(params: IsolateAudioParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse>;
120
+ create(params: IsolateAudioParams, options?: RequestOptions): Promise<TaskCreateResponse>;
121
+ get(id: string, options?: RequestOptions): Promise<AudioTaskResponse>;
122
+ }
123
+
124
+ declare class ElevenlabsClient {
125
+ readonly textToSpeech: TextToSpeech;
126
+ readonly textToDialogue: TextToDialogue;
127
+ readonly textToSound: TextToSound;
128
+ readonly speechToText: SpeechToText;
129
+ readonly isolateAudio: IsolateAudio;
130
+ constructor(options?: ClientOptions);
131
+ }
132
+
133
+ export { type AudioFile, type AudioTaskResponse, type CompletedAudioTaskResponse, type CompletedSpeechToTextResponse, type DialogueLine, ElevenlabsClient, type ElevenlabsSoundEffectOutputFormat, type ElevenlabsSpeechModel, type IsolateAudioParams, type SpeechToTextParams, type SpeechToTextResponse, type TaskCreateResponse, type TextToDialogueParams, type TextToSoundParams, type TextToSpeechParams };
package/dist/index.js ADDED
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ AuthenticationError: () => import_core7.AuthenticationError,
24
+ ElevenlabsClient: () => ElevenlabsClient,
25
+ InsufficientCreditsError: () => import_core7.InsufficientCreditsError,
26
+ NetworkError: () => import_core7.NetworkError,
27
+ NotFoundError: () => import_core7.NotFoundError,
28
+ RateLimitError: () => import_core7.RateLimitError,
29
+ RunApiError: () => import_core7.RunApiError,
30
+ ServiceUnavailableError: () => import_core7.ServiceUnavailableError,
31
+ TaskFailedError: () => import_core7.TaskFailedError,
32
+ TaskTimeoutError: () => import_core7.TaskTimeoutError,
33
+ TimeoutError: () => import_core7.TimeoutError,
34
+ ValidationError: () => import_core7.ValidationError
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/client.ts
39
+ var import_core6 = require("@runapi.ai/core");
40
+
41
+ // src/resources/text-to-speech.ts
42
+ var import_core = require("@runapi.ai/core");
43
+ var import_internal = require("@runapi.ai/core/internal");
44
+ var ENDPOINT = "/api/v1/elevenlabs/text_to_speech";
45
+ var TextToSpeech = class {
46
+ constructor(http) {
47
+ this.http = http;
48
+ }
49
+ http;
50
+ async run(params, options) {
51
+ const { id } = await this.create(params, options);
52
+ const response = await (0, import_internal.pollUntilComplete)(() => this.get(id, options), {
53
+ maxWaitMs: options?.maxWaitMs,
54
+ pollIntervalMs: options?.pollIntervalMs
55
+ });
56
+ return response;
57
+ }
58
+ async create(params, options) {
59
+ return this.http.request("POST", ENDPOINT, {
60
+ body: (0, import_core.compactParams)(params),
61
+ ...options
62
+ });
63
+ }
64
+ async get(id, options) {
65
+ return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
66
+ }
67
+ };
68
+
69
+ // src/resources/text-to-dialogue.ts
70
+ var import_core2 = require("@runapi.ai/core");
71
+ var import_internal2 = require("@runapi.ai/core/internal");
72
+ var ENDPOINT2 = "/api/v1/elevenlabs/text_to_dialogue";
73
+ var TextToDialogue = class {
74
+ constructor(http) {
75
+ this.http = http;
76
+ }
77
+ http;
78
+ async run(params, options) {
79
+ const { id } = await this.create(params, options);
80
+ const response = await (0, import_internal2.pollUntilComplete)(() => this.get(id, options), {
81
+ maxWaitMs: options?.maxWaitMs,
82
+ pollIntervalMs: options?.pollIntervalMs
83
+ });
84
+ return response;
85
+ }
86
+ async create(params, options) {
87
+ return this.http.request("POST", ENDPOINT2, {
88
+ body: (0, import_core2.compactParams)(params),
89
+ ...options
90
+ });
91
+ }
92
+ async get(id, options) {
93
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
94
+ }
95
+ };
96
+
97
+ // src/resources/text-to-sound.ts
98
+ var import_core3 = require("@runapi.ai/core");
99
+ var import_internal3 = require("@runapi.ai/core/internal");
100
+ var ENDPOINT3 = "/api/v1/elevenlabs/text_to_sound";
101
+ var TextToSound = class {
102
+ constructor(http) {
103
+ this.http = http;
104
+ }
105
+ http;
106
+ async run(params, options) {
107
+ const { id } = await this.create(params, options);
108
+ const response = await (0, import_internal3.pollUntilComplete)(() => this.get(id, options), {
109
+ maxWaitMs: options?.maxWaitMs,
110
+ pollIntervalMs: options?.pollIntervalMs
111
+ });
112
+ return response;
113
+ }
114
+ async create(params, options) {
115
+ return this.http.request("POST", ENDPOINT3, {
116
+ body: (0, import_core3.compactParams)(params),
117
+ ...options
118
+ });
119
+ }
120
+ async get(id, options) {
121
+ return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
122
+ }
123
+ };
124
+
125
+ // src/resources/speech-to-text.ts
126
+ var import_core4 = require("@runapi.ai/core");
127
+ var import_internal4 = require("@runapi.ai/core/internal");
128
+ var ENDPOINT4 = "/api/v1/elevenlabs/speech_to_text";
129
+ var SpeechToText = class {
130
+ constructor(http) {
131
+ this.http = http;
132
+ }
133
+ http;
134
+ async run(params, options) {
135
+ const { id } = await this.create(params, options);
136
+ const response = await (0, import_internal4.pollUntilComplete)(() => this.get(id, options), {
137
+ maxWaitMs: options?.maxWaitMs,
138
+ pollIntervalMs: options?.pollIntervalMs
139
+ });
140
+ return response;
141
+ }
142
+ async create(params, options) {
143
+ return this.http.request("POST", ENDPOINT4, {
144
+ body: (0, import_core4.compactParams)(params),
145
+ ...options
146
+ });
147
+ }
148
+ async get(id, options) {
149
+ return this.http.request("GET", `${ENDPOINT4}/${id}`, options ?? {});
150
+ }
151
+ };
152
+
153
+ // src/resources/isolate-audio.ts
154
+ var import_core5 = require("@runapi.ai/core");
155
+ var import_internal5 = require("@runapi.ai/core/internal");
156
+ var ENDPOINT5 = "/api/v1/elevenlabs/isolate_audio";
157
+ var IsolateAudio = class {
158
+ constructor(http) {
159
+ this.http = http;
160
+ }
161
+ http;
162
+ async run(params, options) {
163
+ const { id } = await this.create(params, options);
164
+ const response = await (0, import_internal5.pollUntilComplete)(() => this.get(id, options), {
165
+ maxWaitMs: options?.maxWaitMs,
166
+ pollIntervalMs: options?.pollIntervalMs
167
+ });
168
+ return response;
169
+ }
170
+ async create(params, options) {
171
+ return this.http.request("POST", ENDPOINT5, {
172
+ body: (0, import_core5.compactParams)(params),
173
+ ...options
174
+ });
175
+ }
176
+ async get(id, options) {
177
+ return this.http.request("GET", `${ENDPOINT5}/${id}`, options ?? {});
178
+ }
179
+ };
180
+
181
+ // src/client.ts
182
+ var ElevenlabsClient = class {
183
+ textToSpeech;
184
+ textToDialogue;
185
+ textToSound;
186
+ speechToText;
187
+ isolateAudio;
188
+ constructor(options = {}) {
189
+ const http = (0, import_core6.createHttpClient)(options);
190
+ this.textToSpeech = new TextToSpeech(http);
191
+ this.textToDialogue = new TextToDialogue(http);
192
+ this.textToSound = new TextToSound(http);
193
+ this.speechToText = new SpeechToText(http);
194
+ this.isolateAudio = new IsolateAudio(http);
195
+ }
196
+ };
197
+
198
+ // src/index.ts
199
+ var import_core7 = require("@runapi.ai/core");
200
+ // Annotate the CommonJS export names for ESM import in node:
201
+ 0 && (module.exports = {
202
+ AuthenticationError,
203
+ ElevenlabsClient,
204
+ InsufficientCreditsError,
205
+ NetworkError,
206
+ NotFoundError,
207
+ RateLimitError,
208
+ RunApiError,
209
+ ServiceUnavailableError,
210
+ TaskFailedError,
211
+ TaskTimeoutError,
212
+ TimeoutError,
213
+ ValidationError
214
+ });
215
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/text-to-speech.ts","../src/resources/text-to-dialogue.ts","../src/resources/text-to-sound.ts","../src/resources/speech-to-text.ts","../src/resources/isolate-audio.ts"],"sourcesContent":["export { ElevenlabsClient } from './client';\nexport * from './types';\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n","import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToSpeech } from './resources/text-to-speech';\nimport { TextToDialogue } from './resources/text-to-dialogue';\nimport { TextToSound } from './resources/text-to-sound';\nimport { SpeechToText } from './resources/speech-to-text';\nimport { IsolateAudio } from './resources/isolate-audio';\n\nexport class ElevenlabsClient {\n public readonly textToSpeech: TextToSpeech;\n public readonly textToDialogue: TextToDialogue;\n public readonly textToSound: TextToSound;\n public readonly speechToText: SpeechToText;\n public readonly isolateAudio: IsolateAudio;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToSpeech = new TextToSpeech(http);\n this.textToDialogue = new TextToDialogue(http);\n this.textToSound = new TextToSound(http);\n this.speechToText = new SpeechToText(http);\n this.isolateAudio = new IsolateAudio(http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { AudioTaskResponse, CompletedAudioTaskResponse, TextToSpeechParams, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/text_to_speech';\n\nexport class TextToSpeech {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToSpeechParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: TextToSpeechParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { AudioTaskResponse, CompletedAudioTaskResponse, TextToDialogueParams, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/text_to_dialogue';\n\nexport class TextToDialogue {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToDialogueParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: TextToDialogueParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { AudioTaskResponse, CompletedAudioTaskResponse, TextToSoundParams, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/text_to_sound';\n\nexport class TextToSound {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToSoundParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: TextToSoundParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { CompletedSpeechToTextResponse, TaskCreateResponse, SpeechToTextParams, SpeechToTextResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/speech_to_text';\n\nexport class SpeechToText {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: SpeechToTextParams, options?: RequestOptions & PollingOptions): Promise<CompletedSpeechToTextResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<SpeechToTextResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedSpeechToTextResponse;\n }\n\n async create(params: SpeechToTextParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<SpeechToTextResponse> {\n return this.http.request<SpeechToTextResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { IsolateAudioParams, AudioTaskResponse, CompletedAudioTaskResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/isolate_audio';\n\nexport class IsolateAudio {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: IsolateAudioParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: IsolateAudioParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAAqD;;;ACCrD,kBAA8B;AAC9B,sBAAkC;AAGlC,IAAM,WAAW;AAEV,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,IAAI,QAA4B,SAAgF;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Ae,IAAI,aAAa,IAAI;AACzC,SAAK,eAAe,IAAI,aAAa,IAAI;AAAA,EAC3C;AACF;;;ADpBA,IAAAC,eAYO;","names":["import_core","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core","import_internal","ENDPOINT","import_core"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,189 @@
1
+ // src/client.ts
2
+ import { createHttpClient } from "@runapi.ai/core";
3
+
4
+ // src/resources/text-to-speech.ts
5
+ import { compactParams } from "@runapi.ai/core";
6
+ import { pollUntilComplete } from "@runapi.ai/core/internal";
7
+ var ENDPOINT = "/api/v1/elevenlabs/text_to_speech";
8
+ var TextToSpeech = class {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ http;
13
+ async run(params, options) {
14
+ const { id } = await this.create(params, options);
15
+ const response = await pollUntilComplete(() => this.get(id, options), {
16
+ maxWaitMs: options?.maxWaitMs,
17
+ pollIntervalMs: options?.pollIntervalMs
18
+ });
19
+ return response;
20
+ }
21
+ async create(params, options) {
22
+ return this.http.request("POST", ENDPOINT, {
23
+ body: compactParams(params),
24
+ ...options
25
+ });
26
+ }
27
+ async get(id, options) {
28
+ return this.http.request("GET", `${ENDPOINT}/${id}`, options ?? {});
29
+ }
30
+ };
31
+
32
+ // src/resources/text-to-dialogue.ts
33
+ import { compactParams as compactParams2 } from "@runapi.ai/core";
34
+ import { pollUntilComplete as pollUntilComplete2 } from "@runapi.ai/core/internal";
35
+ var ENDPOINT2 = "/api/v1/elevenlabs/text_to_dialogue";
36
+ var TextToDialogue = class {
37
+ constructor(http) {
38
+ this.http = http;
39
+ }
40
+ http;
41
+ async run(params, options) {
42
+ const { id } = await this.create(params, options);
43
+ const response = await pollUntilComplete2(() => this.get(id, options), {
44
+ maxWaitMs: options?.maxWaitMs,
45
+ pollIntervalMs: options?.pollIntervalMs
46
+ });
47
+ return response;
48
+ }
49
+ async create(params, options) {
50
+ return this.http.request("POST", ENDPOINT2, {
51
+ body: compactParams2(params),
52
+ ...options
53
+ });
54
+ }
55
+ async get(id, options) {
56
+ return this.http.request("GET", `${ENDPOINT2}/${id}`, options ?? {});
57
+ }
58
+ };
59
+
60
+ // src/resources/text-to-sound.ts
61
+ import { compactParams as compactParams3 } from "@runapi.ai/core";
62
+ import { pollUntilComplete as pollUntilComplete3 } from "@runapi.ai/core/internal";
63
+ var ENDPOINT3 = "/api/v1/elevenlabs/text_to_sound";
64
+ var TextToSound = class {
65
+ constructor(http) {
66
+ this.http = http;
67
+ }
68
+ http;
69
+ async run(params, options) {
70
+ const { id } = await this.create(params, options);
71
+ const response = await pollUntilComplete3(() => this.get(id, options), {
72
+ maxWaitMs: options?.maxWaitMs,
73
+ pollIntervalMs: options?.pollIntervalMs
74
+ });
75
+ return response;
76
+ }
77
+ async create(params, options) {
78
+ return this.http.request("POST", ENDPOINT3, {
79
+ body: compactParams3(params),
80
+ ...options
81
+ });
82
+ }
83
+ async get(id, options) {
84
+ return this.http.request("GET", `${ENDPOINT3}/${id}`, options ?? {});
85
+ }
86
+ };
87
+
88
+ // src/resources/speech-to-text.ts
89
+ import { compactParams as compactParams4 } from "@runapi.ai/core";
90
+ import { pollUntilComplete as pollUntilComplete4 } from "@runapi.ai/core/internal";
91
+ var ENDPOINT4 = "/api/v1/elevenlabs/speech_to_text";
92
+ var SpeechToText = class {
93
+ constructor(http) {
94
+ this.http = http;
95
+ }
96
+ http;
97
+ async run(params, options) {
98
+ const { id } = await this.create(params, options);
99
+ const response = await pollUntilComplete4(() => this.get(id, options), {
100
+ maxWaitMs: options?.maxWaitMs,
101
+ pollIntervalMs: options?.pollIntervalMs
102
+ });
103
+ return response;
104
+ }
105
+ async create(params, options) {
106
+ return this.http.request("POST", ENDPOINT4, {
107
+ body: compactParams4(params),
108
+ ...options
109
+ });
110
+ }
111
+ async get(id, options) {
112
+ return this.http.request("GET", `${ENDPOINT4}/${id}`, options ?? {});
113
+ }
114
+ };
115
+
116
+ // src/resources/isolate-audio.ts
117
+ import { compactParams as compactParams5 } from "@runapi.ai/core";
118
+ import { pollUntilComplete as pollUntilComplete5 } from "@runapi.ai/core/internal";
119
+ var ENDPOINT5 = "/api/v1/elevenlabs/isolate_audio";
120
+ var IsolateAudio = class {
121
+ constructor(http) {
122
+ this.http = http;
123
+ }
124
+ http;
125
+ async run(params, options) {
126
+ const { id } = await this.create(params, options);
127
+ const response = await pollUntilComplete5(() => this.get(id, options), {
128
+ maxWaitMs: options?.maxWaitMs,
129
+ pollIntervalMs: options?.pollIntervalMs
130
+ });
131
+ return response;
132
+ }
133
+ async create(params, options) {
134
+ return this.http.request("POST", ENDPOINT5, {
135
+ body: compactParams5(params),
136
+ ...options
137
+ });
138
+ }
139
+ async get(id, options) {
140
+ return this.http.request("GET", `${ENDPOINT5}/${id}`, options ?? {});
141
+ }
142
+ };
143
+
144
+ // src/client.ts
145
+ var ElevenlabsClient = class {
146
+ textToSpeech;
147
+ textToDialogue;
148
+ textToSound;
149
+ speechToText;
150
+ isolateAudio;
151
+ constructor(options = {}) {
152
+ const http = createHttpClient(options);
153
+ this.textToSpeech = new TextToSpeech(http);
154
+ this.textToDialogue = new TextToDialogue(http);
155
+ this.textToSound = new TextToSound(http);
156
+ this.speechToText = new SpeechToText(http);
157
+ this.isolateAudio = new IsolateAudio(http);
158
+ }
159
+ };
160
+
161
+ // src/index.ts
162
+ import {
163
+ RunApiError,
164
+ AuthenticationError,
165
+ InsufficientCreditsError,
166
+ NotFoundError,
167
+ ValidationError,
168
+ RateLimitError,
169
+ ServiceUnavailableError,
170
+ NetworkError,
171
+ TimeoutError,
172
+ TaskTimeoutError,
173
+ TaskFailedError
174
+ } from "@runapi.ai/core";
175
+ export {
176
+ AuthenticationError,
177
+ ElevenlabsClient,
178
+ InsufficientCreditsError,
179
+ NetworkError,
180
+ NotFoundError,
181
+ RateLimitError,
182
+ RunApiError,
183
+ ServiceUnavailableError,
184
+ TaskFailedError,
185
+ TaskTimeoutError,
186
+ TimeoutError,
187
+ ValidationError
188
+ };
189
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts","../src/resources/text-to-speech.ts","../src/resources/text-to-dialogue.ts","../src/resources/text-to-sound.ts","../src/resources/speech-to-text.ts","../src/resources/isolate-audio.ts","../src/index.ts"],"sourcesContent":["import { createHttpClient, type ClientOptions } from '@runapi.ai/core';\nimport { TextToSpeech } from './resources/text-to-speech';\nimport { TextToDialogue } from './resources/text-to-dialogue';\nimport { TextToSound } from './resources/text-to-sound';\nimport { SpeechToText } from './resources/speech-to-text';\nimport { IsolateAudio } from './resources/isolate-audio';\n\nexport class ElevenlabsClient {\n public readonly textToSpeech: TextToSpeech;\n public readonly textToDialogue: TextToDialogue;\n public readonly textToSound: TextToSound;\n public readonly speechToText: SpeechToText;\n public readonly isolateAudio: IsolateAudio;\n\n constructor(options: ClientOptions = {}) {\n const http = createHttpClient(options);\n this.textToSpeech = new TextToSpeech(http);\n this.textToDialogue = new TextToDialogue(http);\n this.textToSound = new TextToSound(http);\n this.speechToText = new SpeechToText(http);\n this.isolateAudio = new IsolateAudio(http);\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { AudioTaskResponse, CompletedAudioTaskResponse, TextToSpeechParams, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/text_to_speech';\n\nexport class TextToSpeech {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToSpeechParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: TextToSpeechParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { AudioTaskResponse, CompletedAudioTaskResponse, TextToDialogueParams, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/text_to_dialogue';\n\nexport class TextToDialogue {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToDialogueParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: TextToDialogueParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { AudioTaskResponse, CompletedAudioTaskResponse, TextToSoundParams, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/text_to_sound';\n\nexport class TextToSound {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: TextToSoundParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: TextToSoundParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { CompletedSpeechToTextResponse, TaskCreateResponse, SpeechToTextParams, SpeechToTextResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/speech_to_text';\n\nexport class SpeechToText {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: SpeechToTextParams, options?: RequestOptions & PollingOptions): Promise<CompletedSpeechToTextResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<SpeechToTextResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedSpeechToTextResponse;\n }\n\n async create(params: SpeechToTextParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<SpeechToTextResponse> {\n return this.http.request<SpeechToTextResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","import type { HttpClient, PollingOptions, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type { IsolateAudioParams, AudioTaskResponse, CompletedAudioTaskResponse, TaskCreateResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/elevenlabs/isolate_audio';\n\nexport class IsolateAudio {\n constructor(private readonly http: HttpClient) {}\n\n async run(params: IsolateAudioParams, options?: RequestOptions & PollingOptions): Promise<CompletedAudioTaskResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<AudioTaskResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedAudioTaskResponse;\n }\n\n async create(params: IsolateAudioParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n async get(id: string, options?: RequestOptions): Promise<AudioTaskResponse> {\n return this.http.request<AudioTaskResponse>('GET', `${ENDPOINT}/${id}`, options ?? {});\n }\n}\n","export { ElevenlabsClient } from './client';\nexport * from './types';\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n TaskTimeoutError,\n TaskFailedError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,wBAA4C;;;ACCrD,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAGlC,IAAM,WAAW;AAEV,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EAE7B,MAAM,IAAI,QAA4B,SAAgF;AACpH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAqC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACvF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,QAA4B,SAAuD;AAC9F,WAAO,KAAK,KAAK,QAA4B,QAAQ,UAAU;AAAA,MAC7D,MAAM,cAAc,MAAM;AAAA,MA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pollUntilComplete","ENDPOINT","compactParams","pollUntilComplete","ENDPOINT"]}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@runapi.ai/elevenlabs",
3
+ "version": "0.2.0",
4
+ "description": "RunAPI ElevenLabs SDK for JavaScript, Ruby, and Go",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "skills",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "engines": {
22
+ "node": ">=18.0.0"
23
+ },
24
+ "scripts": {
25
+ "build": "tsup",
26
+ "test": "vitest run",
27
+ "typecheck": "tsc --noEmit",
28
+ "clean": "rm -rf dist"
29
+ },
30
+ "dependencies": {
31
+ "@runapi.ai/core": "^0.2.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^20.0.0",
35
+ "@vitest/coverage-v8": "^1.6.0",
36
+ "tsup": "^8.0.0",
37
+ "typescript": "^5.4.0",
38
+ "vitest": "^1.6.0"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "keywords": [
44
+ "runapi",
45
+ "runapi-ai",
46
+ "elevenlabs",
47
+ "api",
48
+ "sdk",
49
+ "typescript",
50
+ "ruby",
51
+ "golang"
52
+ ],
53
+ "author": "RunAPI",
54
+ "license": "Apache-2.0",
55
+ "homepage": "https://runapi.ai/models/elevenlabs",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/runapi-ai/elevenlabs-sdk.git"
59
+ }
60
+ }
@@ -0,0 +1,56 @@
1
+ # ElevenLabs API Skill for RunAPI
2
+
3
+ Generate speech, dialogue, sound effects, transcriptions, and isolated audio with the ElevenLabs SDK. This skill helps Claude Code, Codex, Gemini CLI, Cursor, and 50+ agents integrate ElevenLabs through RunAPI.
4
+
5
+ The canonical agent file is `skills/elevenlabs/SKILL.md`.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npx skills add runapi-ai/elevenlabs -g
11
+ ```
12
+
13
+ Or manually: clone this repo and copy `skills/elevenlabs/` into your agent's skills directory.
14
+
15
+ ## Quick example
16
+
17
+ ```typescript
18
+ import { ElevenlabsClient } from '@runapi.ai/elevenlabs';
19
+
20
+ const client = new ElevenlabsClient();
21
+ const result = await client.textToSpeech.run({
22
+ model: 'text-to-speech-turbo-2-5',
23
+ text: 'Hello from RunAPI.',
24
+ voice: 'Rachel',
25
+ });
26
+ const audioUrl = result.audios[0].url;
27
+ ```
28
+
29
+ ## Routing
30
+
31
+ - Model page: https://runapi.ai/models/elevenlabs
32
+ - Product docs: https://runapi.ai/docs#elevenlabs
33
+ - SDK docs: https://runapi.ai/docs#sdk-elevenlabs
34
+ - SDK repository: https://github.com/runapi-ai/elevenlabs-sdk
35
+ - Pricing and rate limits: https://runapi.ai/models/elevenlabs/text-to-speech-turbo-v2.5
36
+ - Provider comparison: https://runapi.ai/providers/elevenlabs
37
+ - Browse all RunAPI models and skills: https://runapi.ai/models
38
+
39
+ ## Variants
40
+
41
+ - [Turbo v2.5 text to speech](https://runapi.ai/models/elevenlabs/text-to-speech-turbo-v2.5)
42
+ - [Multilingual v2 text to speech](https://runapi.ai/models/elevenlabs/text-to-speech-multilingual-v2)
43
+ - [Dialogue v3](https://runapi.ai/models/elevenlabs/text-to-dialogue-v3)
44
+ - [Sound effects v2](https://runapi.ai/models/elevenlabs/sound-effect-v2)
45
+ - [Speech to text](https://runapi.ai/models/elevenlabs/speech-to-text)
46
+ - [Audio isolation](https://runapi.ai/models/elevenlabs/audio-isolation)
47
+
48
+ ## Agent rules
49
+
50
+ - Keep API keys in `RUNAPI_API_KEY` or RunAPI CLI config; never commit secrets.
51
+ - Prefer `create`, `get`, and `run` JSON passthrough patterns instead of inventing flags for every model parameter.
52
+ - For elevenlabs api pricing, rate-limit, and commercial-usage answers, link to the variant page rather than the repository README.
53
+
54
+ ## License
55
+
56
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,211 @@
1
+ ---
2
+ name: elevenlabs
3
+ description: Generate and process audio (text-to-speech, multi-voice text-to-dialogue, text-to-sound, speech-to-text, isolate audio) through RunAPI.ai using the @runapi.ai/elevenlabs Node/TypeScript SDK. Use when the user asks to add text-to-speech, voice synthesis, speech-to-text, or text-to-sound, or writes against @runapi.ai/elevenlabs. Triggers on "elevenlabs", "text to speech", "TTS", "语音合成", "speech-to-text", "转录", "text-to-sound", "@runapi.ai/elevenlabs".
4
+ documentation: https://runapi.ai/models/elevenlabs
5
+ provider_page: https://runapi.ai/providers/elevenlabs
6
+ catalog: https://runapi.ai/models
7
+ ---
8
+
9
+ # @runapi.ai/elevenlabs — RunAPI.ai Elevenlabs audio generation
10
+
11
+ Build Node / TypeScript integrations that generate speech, text-to-dialogue, text-to-sound, speech-to-text, and isolated audio through RunAPI.ai.
12
+
13
+ ## Setup
14
+
15
+ Requires **Node 18+** (global `fetch`).
16
+
17
+ ```bash
18
+ npm install @runapi.ai/elevenlabs
19
+ ```
20
+
21
+ Set your API key in the environment:
22
+
23
+ ```dotenv
24
+ # .env
25
+ RUNAPI_API_KEY=runapi_xxx # get one at https://runapi.ai/settings/api_keys
26
+ ```
27
+
28
+ ```ts
29
+ import { ElevenlabsClient } from '@runapi.ai/elevenlabs';
30
+
31
+ // The SDK reads RUNAPI_API_KEY from the environment automatically.
32
+ const client = new ElevenlabsClient();
33
+ ```
34
+
35
+ Pass `{ apiKey }` explicitly if you manage secrets differently. `baseUrl` defaults to `https://runapi.ai`; override only for local development.
36
+
37
+ ## Core recipe — text to speech
38
+
39
+ ```ts
40
+ const result = await client.textToSpeech.run({
41
+ model: 'text-to-speech-turbo-2-5',
42
+ text: 'Hello from RunAPI.',
43
+ voice: 'Rachel',
44
+ });
45
+
46
+ const audioUrl = result.audios[0].url;
47
+ ```
48
+
49
+ `run()` creates the task, auto-polls, and resolves only when the task completes — `audios[0].url` is guaranteed on the resolved value (for speech-to-text, `text` is guaranteed). On failure it throws `TaskFailedError`; on polling timeout it throws `TaskTimeoutError`. Use `run()` for scripts and short-lived processes. For request handlers, split it:
50
+
51
+ ```ts
52
+ const { id } = await client.textToSpeech.create({ model: 'text-to-speech-turbo-2-5', text: '...', voice: 'Rachel' });
53
+ // return 202 immediately; fetch later:
54
+ const status = await client.textToSpeech.get(id);
55
+ if (status.status === 'completed') { /* ... */ }
56
+ ```
57
+
58
+ Do not hold a web worker open waiting on `run()`. Split + webhook is the production pattern.
59
+
60
+ `run()` polls every 2 s for up to 15 min by default. Tune when needed:
61
+
62
+ ```ts
63
+ await client.textToSpeech.run(params, { maxWaitMs: 2 * 60_000, pollIntervalMs: 1_000 });
64
+ ```
65
+
66
+ If `TaskTimeoutError` fires, the task is still running server-side — resume with `<resource>.get(id)` or finish via webhook.
67
+
68
+ ## Multi-voice dialogue
69
+
70
+ Sequence lines with per-line `voice`:
71
+
72
+ ```ts
73
+ const dialogue = await client.textToDialogue.run({
74
+ dialogue: [
75
+ { voice: 'Rachel', text: 'So what did you think?' },
76
+ { voice: 'Adam', text: 'Honestly, it was incredible.' },
77
+ ],
78
+ stability: 0.5,
79
+ language_code: 'en',
80
+ });
81
+
82
+ console.log(dialogue.audios[0].url);
83
+ ```
84
+
85
+ ## Sound effects
86
+
87
+ ```ts
88
+ const fx = await client.textToSound.run({
89
+ text: 'Thunderclap followed by rain on a tin roof',
90
+ duration_seconds: 6,
91
+ loop: false,
92
+ output_format: 'mp3_44100_128',
93
+ });
94
+ ```
95
+
96
+ ## Speech to Text (audio in → text out)
97
+
98
+ ```ts
99
+ const t = await client.speechToText.run({
100
+ audio_url: 'https://cdn.example.com/meeting.mp3',
101
+ diarize: true,
102
+ tag_audio_events: true,
103
+ language_code: 'en',
104
+ });
105
+
106
+ console.log(t.text);
107
+ ```
108
+
109
+ ## Audio isolation (remove background noise)
110
+
111
+ ```ts
112
+ const isolated = await client.isolateAudio.run({
113
+ audio_url: 'https://cdn.example.com/noisy.mp3',
114
+ });
115
+
116
+ console.log(isolated.audios[0].url);
117
+ ```
118
+
119
+ ## Models
120
+
121
+ | Resource | `model` values |
122
+ |---|---|
123
+ | `textToSpeech` | `text-to-speech-turbo-2-5`, `text-to-speech-multilingual-v2` |
124
+ | `textToDialogue` | — (no `model` field; server picks the engine) |
125
+ | `textToSound` | — |
126
+ | `speechToText` | — |
127
+ | `isolateAudio` | — |
128
+
129
+ Pick the turbo model for the lowest latency; pick multilingual v2 for non-English voices. `voice` accepts Elevenlabs voice IDs or named voices (e.g. `'Rachel'`, `'Adam'`).
130
+
131
+ Exact credit costs are shown at https://runapi.ai/pricing and in the dashboard — do not hardcode prices in application code.
132
+
133
+ ## Callbacks (webhooks)
134
+
135
+ Pass `callback_url` on `create()` (or any `run()` call) and RunAPI will POST the final payload to you:
136
+
137
+ ```ts
138
+ await client.textToSpeech.create({
139
+ model: 'text-to-speech-turbo-2-5',
140
+ text: '...',
141
+ voice: 'Rachel',
142
+ callback_url: 'https://your.app/webhooks/runapi/elevenlabs',
143
+ });
144
+ ```
145
+
146
+ Payload shape (audio resources):
147
+
148
+ ```ts
149
+ { id: string; status: 'completed' | 'failed'; audios?: { url: string }[]; error?: string }
150
+ ```
151
+
152
+ SpeechToText return `text: string` instead of `audios`.
153
+
154
+ **Always verify the signature before trusting the body.** RunAPI signs every callback with your account's Callback Secret (rotate at `/accounts/callback_secret`). Headers:
155
+
156
+ - `X-Callback-Id` — UUID, store to make handler idempotent
157
+ - `X-Callback-Timestamp` — unix seconds, reject if `|now - ts| > 300`
158
+ - `X-Callback-Signature` — base64 HMAC-SHA256 over `` `${id}.${ts}.${rawBody}` `` using the base64-decoded secret
159
+
160
+ ```ts
161
+ import crypto from 'node:crypto';
162
+
163
+ function verify(raw: string, id: string, ts: string, sig: string, secret: string) {
164
+ const key = Buffer.from(secret, 'base64');
165
+ const mac = crypto.createHmac('sha256', key)
166
+ .update(`${id}.${ts}.${raw}`)
167
+ .digest('base64');
168
+ return crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(sig));
169
+ }
170
+ ```
171
+
172
+ Reply `2xx` within 10s; any non-2xx triggers retries.
173
+
174
+ ## Errors
175
+
176
+ All errors are re-exported from `@runapi.ai/core`. Always `instanceof` — never string-match messages.
177
+
178
+ | Error | Status | Action |
179
+ |---|---|---|
180
+ | `AuthenticationError` | 401 | abort; surface "reconnect your API key" |
181
+ | `InsufficientCreditsError` | 402 | prompt user to top up at runapi.ai/billing |
182
+ | `ValidationError` | 400 / 422 | fix params; do not retry |
183
+ | `RateLimitError` | 429 | sleep `err.retryAfterMs`, then retry |
184
+ | `ServiceUnavailableError` | 503 / 455 | retry with backoff; transient service issue |
185
+ | `TaskFailedError` | — | show `err.details` to user; do not auto-retry |
186
+ | `TaskTimeoutError` | — | re-poll with `<resource>.get(id)` |
187
+
188
+ ```ts
189
+ import { InsufficientCreditsError, TaskFailedError } from '@runapi.ai/elevenlabs';
190
+
191
+ try {
192
+ await client.textToSpeech.run({ model: 'text-to-speech-turbo-2-5', text: '...', voice: 'Rachel' });
193
+ } catch (err) {
194
+ if (err instanceof InsufficientCreditsError) { /* surface top-up CTA */ }
195
+ else if (err instanceof TaskFailedError) { /* show err.details */ }
196
+ else throw err;
197
+ }
198
+ ```
199
+
200
+ ## Gotchas
201
+
202
+ - `textToSpeech` requires `model`; `textToDialogue`, `textToSound`, `speechToText`, and `isolateAudio` do not take a `model` field.
203
+ - `textToDialogue` is an array of `{ voice, text }` lines — voice is per-line, not per-request.
204
+ - `text-to-dialogue.stability` is a fixed enum: `0`, `0.5`, or `1`.
205
+ - `speechToText.run()` returns `{ text }`, not `{ audios }` — the response shape is different from the other resources.
206
+ - `output_format` on `textToSound` covers a wide codec/bitrate matrix (`mp3_*`, `pcm_*`, `ulaw_8000`, `alaw_8000`, `opus_*`) — pick one from the type union, do not invent strings.
207
+ - `callback_url` must be reachable from the public internet. `localhost` / `127.0.0.1` URLs will never fire — use a tunnel (cloudflared, ngrok, tailscale funnel) when developing locally.
208
+
209
+ ## Dig deeper
210
+
211
+ Package README (full API surface, all params): `node_modules/@runapi.ai/elevenlabs/README.md`. Types: `@runapi.ai/elevenlabs/dist/types.d.ts`. Product docs: https://runapi.ai/docs.