|
1
|
# ElevenLabs |
|
2
|
|
|
3
|
Proxy requests to ElevenLabs via Replit-managed billing. |
|
4
|
|
|
5
|
## Callback |
|
6
|
|
|
7
|
Use `externalApi__elevenlabs` in `code_execution`. |
|
8
|
|
|
9
|
## Allowed operations |
|
10
|
|
|
11
|
- `POST` `/v1/text-to-speech/:voice_id{/stream}?{/with-timestamps}?` - Text to Speech (non-streaming, streaming, with-timestamps, and stream/with-timestamps variants) |
|
12
|
- `POST` `/v1/text-to-dialogue{/stream}?{/with-timestamps}?` - Text to Dialogue (multi-voice; non-streaming, streaming, with-timestamps, and stream/with-timestamps variants) |
|
13
|
- `POST` `/v1/speech-to-text` - Speech to Text (Scribe v1/v2) |
|
14
|
- `POST` `/v1/speech-to-speech/:voice_id{/stream}?` - Voice Changer (speech-to-speech; non-streaming and streaming variants) |
|
15
|
- `POST` `/v1/sound-generation` - Sound Effects (text → sound generation) |
|
16
|
- `POST` `/v1/audio-isolation{/stream}?` - Voice Isolator (audio-isolation; non-streaming and streaming variants) |
|
17
|
- `POST` `/v1/forced-alignment` - Forced Alignment (audio + text → word/char timings) |
|
18
|
- `POST` `/v1/text-to-voice/:variant(design|create-previews)` - Voice Design (text → three voice previews; charged once on response.text characters). Covers `/design` and legacy `/create-previews`. |
|
19
|
- `POST` `/v1/text-to-voice/:voice_id/remix` - Voice Remix (remix existing voice → three previews; charged once on response.text characters). Shares billing mechanics with text_to_voice_design. |
|
20
|
- `POST` `/v1/dubbing` - Dubbing v1 — creates a dub job; bills on response expected_duration_sec × tier-per-sec (watermark vs clean) |
|
21
|
- `POST` `/v1/music{/:variant(detailed|stream)}?` - Music composition (non-streaming binary, multipart-detailed with JSON metadata, and event-stream variants) |
|
22
|
- `POST` `/v1/music/video-to-music` - Video to Music (multipart videos → generated music matching combined video length) |
|
23
|
- `POST` `/v1/music/stem-separation` - Music Stem Separation (split input audio into N stems; bills on multipart input file size ÷ nominal 128 kbps — see preamble for bitrate-assumption rationale) |
|
24
|
- `GET` | `POST` | `PUT` | `PATCH` | `DELETE` `/:path+` - Catch-all — no charge for paths not explicitly listed (CRUD, metadata, workspace/convai management). |
|
25
|
|
|
26
|
Authorization is handled automatically by Replit. Do not pass an `Authorization` header. |
|
27
|
|
|
28
|
## Skill |
|
29
|
|
|
30
|
## ElevenLabs quickstart |
|
31
|
|
|
32
|
Text-to-speech, music, and audio tools through ElevenLabs |
|
33
|
passthrough billing. Replace path parameters like `:voice_id` |
|
34
|
with real values — never send the pattern syntax literally. Send |
|
35
|
required fields as an object in `body` (it is serialized for you |
|
36
|
— do not pre-stringify). |
|
37
|
|
|
38
|
```javascript |
|
39
|
const voices = await externalApi__elevenlabs({ |
|
40
|
path: '/v1/voices', |
|
41
|
method: 'GET', |
|
42
|
}) |
|
43
|
|
|
44
|
const voiceId = voices.body.voices?.[0]?.voice_id |
|
45
|
if (!voiceId) throw new Error('No ElevenLabs voices available') |
|
46
|
|
|
47
|
const result = await externalApi__elevenlabs({ |
|
48
|
path: '/v1/text-to-speech/' + voiceId + '/with-timestamps', |
|
49
|
method: 'POST', |
|
50
|
headers: {'Content-Type': 'application/json'}, |
|
51
|
body: {text: 'Hello from Replit!', model_id: 'eleven_multilingual_v2'}, |
|
52
|
}) |
|
53
|
|
|
54
|
const audioBase64 = result.body.audio_base64 |
|
55
|
|
|
56
|
// File writes and imports are impure — keep them inside the |
|
57
|
// "use impure" boundary; pass the (serializable) base64 string in. |
|
58
|
await (async function (base64, out) { |
|
59
|
"use impure"; |
|
60
|
const fs = await import('node:fs/promises') |
|
61
|
await fs.mkdir('attached_assets', {recursive: true}) |
|
62
|
await fs.writeFile(out, Buffer.from(base64, 'base64')) |
|
63
|
})(audioBase64, 'attached_assets/speech.mp3') |
|
64
|
``` |
|
65
|
|
|
66
|
The `/with-timestamps` variant returns JSON with base64 audio, |
|
67
|
which is easiest to save from a callback. |
|
68
|
|
|
69
|
Authorization is managed by passthrough billing. Do not set an |
|
70
|
`Authorization` header manually. |
|
71
|
|
|
72
|
## Example |
|
73
|
|
|
74
|
```javascript |
|
75
|
const result = await externalApi__elevenlabs({ |
|
76
|
path: '/v1/text-to-speech/:voice_id{/stream}?{/with-timestamps}?', |
|
77
|
method: 'POST', |
|
78
|
query: {}, |
|
79
|
}) |
|
80
|
|
|
81
|
console.log(result.status) |
|
82
|
console.log(result.body) |
|
83
|
``` |