@runapi.ai/elevenlabs 0.2.0 → 0.2.3

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/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type ElevenlabsSpeechModel = 'text-to-speech-turbo-2-5' | 'text-to-speech-multilingual-v2';
4
+ type ElevenlabsSpeechModel = 'text-to-speech-turbo-v2.5' | 'text-to-speech-multilingual-v2';
5
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
6
  interface TaskCreateResponse {
7
7
  id: string;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, ClientOptions } from '@runapi.ai/core';
2
2
  export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
3
3
 
4
- type ElevenlabsSpeechModel = 'text-to-speech-turbo-2-5' | 'text-to-speech-multilingual-v2';
4
+ type ElevenlabsSpeechModel = 'text-to-speech-turbo-v2.5' | 'text-to-speech-multilingual-v2';
5
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
6
  interface TaskCreateResponse {
7
7
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runapi.ai/elevenlabs",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "RunAPI ElevenLabs SDK for JavaScript, Ruby, and Go",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "clean": "rm -rf dist"
29
29
  },
30
30
  "dependencies": {
31
- "@runapi.ai/core": "^0.2.0"
31
+ "@runapi.ai/core": "^0.2.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",
@@ -1,4 +1,25 @@
1
- # ElevenLabs API Skill for RunAPI
1
+ <p align="center">
2
+ <a href="https://github.com/runapi-ai/elevenlabs">
3
+ <h3 align="center">ElevenLabs API Skill for RunAPI</h3>
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ Install this agent skill, inspect ElevenLabs fields, then run jobs through the RunAPI CLI.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://runapi.ai/models/elevenlabs"><strong>Model Reference</strong></a> · <a href="https://github.com/runapi-ai/cli"><strong>CLI</strong></a> · <a href="https://github.com/runapi-ai/elevenlabs-sdk"><strong>SDK</strong></a>
13
+ </p>
14
+
15
+ <div align="center">
16
+
17
+ [![skills.sh](https://www.skills.sh/b/runapi-ai/elevenlabs)](https://www.skills.sh/runapi-ai/elevenlabs/elevenlabs)
18
+ [![ClawHub](https://img.shields.io/badge/ClawHub-runapi--elevenlabs-111827)](https://clawhub.ai/runapi-ai/runapi-elevenlabs)
19
+ [![License](https://img.shields.io/github/license/runapi-ai/elevenlabs)](https://github.com/runapi-ai/elevenlabs/blob/main/LICENSE)
20
+
21
+ </div>
22
+ <br/>
2
23
 
3
24
  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
25
 
@@ -10,7 +31,18 @@ The canonical agent file is `skills/elevenlabs/SKILL.md`.
10
31
  npx skills add runapi-ai/elevenlabs -g
11
32
  ```
12
33
 
13
- Or manually: clone this repo and copy `skills/elevenlabs/` into your agent's skills directory.
34
+ Or paste this prompt to your AI agent:
35
+
36
+ ```text
37
+ Install the elevenlabs skill for me:
38
+
39
+ 1. Clone https://github.com/runapi-ai/elevenlabs
40
+ 2. Copy the skills/elevenlabs/ directory into your
41
+ user-level skills directory (e.g. ~/.claude/skills/
42
+ for Claude Code, ~/.codex/skills/ for Codex).
43
+ 3. Verify that SKILL.md is present.
44
+ 4. Confirm the install path when done.
45
+ ```
14
46
 
15
47
  ## Quick example
16
48
 
@@ -19,7 +51,7 @@ import { ElevenlabsClient } from '@runapi.ai/elevenlabs';
19
51
 
20
52
  const client = new ElevenlabsClient();
21
53
  const result = await client.textToSpeech.run({
22
- model: 'text-to-speech-turbo-2-5',
54
+ model: 'text-to-speech-turbo-v2.5',
23
55
  text: 'Hello from RunAPI.',
24
56
  voice: 'Rachel',
25
57
  });
@@ -1,211 +1,81 @@
1
1
  ---
2
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
3
+ description: Generate speech, dialogue, and sound with ElevenLabs through RunAPI. Use when the user asks an agent to create speech, dialogue, or sound effects, or transcribe audio with ElevenLabs. Default to the RunAPI CLI for one-off generation; use SDKs only when the user is integrating RunAPI into an app or backend.
4
+ documentation: https://runapi.ai/models/elevenlabs.md
5
+ provider_page: https://runapi.ai/providers/elevenlabs.md
6
+ catalog: https://runapi.ai/models.md
7
+ metadata:
8
+ openclaw:
9
+ homepage: https://runapi.ai/models/elevenlabs
10
+ requires:
11
+ bins:
12
+ - runapi
13
+ install:
14
+ - kind: brew
15
+ formula: runapi-ai/tap/runapi
16
+ bins:
17
+ - runapi
18
+ envVars:
19
+ - name: RUNAPI_API_KEY
20
+ required: false
21
+ description: Optional RunAPI API key; agents should prefer environment auth or saved CLI config. Browser login is interactive fallback only.
7
22
  ---
8
23
 
9
- # @runapi.ai/elevenlabs RunAPI.ai Elevenlabs audio generation
24
+ # ElevenLabs on RunAPI
10
25
 
11
- Build Node / TypeScript integrations that generate speech, text-to-dialogue, text-to-sound, speech-to-text, and isolated audio through RunAPI.ai.
26
+ Generate speech, dialogue, and sound with ElevenLabs through RunAPI. The default path for one-off agent tasks is the `runapi` CLI; SDKs are for application integration.
12
27
 
13
- ## Setup
28
+ ## Routing decision
14
29
 
15
- Requires **Node 18+** (global `fetch`).
30
+ - One-off generation, editing, or transformation for the user → use the **CLI path** with the `runapi` binary.
31
+ - Building an app, backend, worker, library, or production codebase → use the **SDK integration path**.
16
32
 
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.
33
+ ## CLI path
36
34
 
37
- ## Core recipe text to speech
35
+ The `runapi` binary is the runtime dependency. Run `runapi auth status` first. For agents and headless runs, prefer `RUNAPI_API_KEY` or import it into saved config with `printf '%s' "$RUNAPI_API_KEY" | runapi auth import-token --token -`. Use `runapi login` only when the user explicitly wants interactive browser auth.
38
36
 
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
- });
37
+ Inspect the available actions and request fields with CLI help:
45
38
 
46
- const audioUrl = result.audios[0].url;
39
+ ```shell
40
+ runapi elevenlabs --help
41
+ runapi elevenlabs text-to-speech --help
47
42
  ```
48
43
 
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:
44
+ Run a one-off task (synchronous polls until the task completes):
50
45
 
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') { /* ... */ }
46
+ ```shell
47
+ runapi elevenlabs text-to-speech --input-file request.json
56
48
  ```
57
49
 
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:
50
+ Submit asynchronously and poll separately:
61
51
 
62
- ```ts
63
- await client.textToSpeech.run(params, { maxWaitMs: 2 * 60_000, pollIntervalMs: 1_000 });
52
+ ```shell
53
+ runapi elevenlabs text-to-speech --async --input-file request.json
54
+ runapi wait <task-id> --service elevenlabs --action text-to-speech
64
55
  ```
65
56
 
66
- If `TaskTimeoutError` fires, the task is still running server-side — resume with `<resource>.get(id)` or finish via webhook.
57
+ Available actions: `text-to-speech`, `text-to-dialogue`, `text-to-sound`, `speech-to-text`, `isolate-audio`.
67
58
 
68
- ## Multi-voice dialogue
59
+ ## SDK integration path
69
60
 
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
- ```
61
+ When integrating ElevenLabs into an app, backend, worker, or library — not for one-off tasks — use a RunAPI SDK package:
118
62
 
119
- ## Models
63
+ - JavaScript / TypeScript: `@runapi.ai/elevenlabs`
64
+ - Ruby: `runapi-elevenlabs`
65
+ - Go: `github.com/runapi-ai/elevenlabs-sdk/go`
120
66
 
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
- ```
67
+ ## References
199
68
 
200
- ## Gotchas
69
+ - Model overview, pricing, and rate limits: https://runapi.ai/models/elevenlabs.md
70
+ - Provider comparison: https://runapi.ai/providers/elevenlabs.md
71
+ - Full model catalog: https://runapi.ai/models.md
201
72
 
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.
73
+ ## Variants
208
74
 
209
- ## Dig deeper
75
+ - [Turbo v2.5 text to speech](https://runapi.ai/models/elevenlabs/text-to-speech-turbo-v2.5.md)
76
+ - [Multilingual v2 text to speech](https://runapi.ai/models/elevenlabs/text-to-speech-multilingual-v2.md)
77
+ - [Dialogue v3](https://runapi.ai/models/elevenlabs/text-to-dialogue-v3.md)
78
+ - [Sound effects v2](https://runapi.ai/models/elevenlabs/sound-effect-v2.md)
79
+ - [Speech to text](https://runapi.ai/models/elevenlabs/speech-to-text.md)
80
+ - [Audio isolation](https://runapi.ai/models/elevenlabs/audio-isolation.md)
210
81
 
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.