aillom-vox-client 1.0.1 → 2.1.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 +102 -195
- package/dist/AillomVox.d.ts +78 -19
- package/dist/AillomVox.js +345 -60
- package/dist/constants.d.ts +19 -0
- package/dist/constants.js +35 -0
- package/dist/gateway-url.d.ts +12 -0
- package/dist/gateway-url.js +74 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/pricing.d.ts +26 -0
- package/dist/pricing.js +20 -0
- package/dist/types.d.ts +168 -11
- package/package.json +18 -7
- package/docs/ASTERISK.md +0 -411
- package/docs/PROTOCOL.md +0 -156
- package/docs/PROVIDERS.md +0 -40
- package/docs/TOOLS.md +0 -314
- package/docs/TROUBLESHOOTING.md +0 -86
- package/docs/VOICES.md +0 -219
- package/docs/providers/AILLOMVOX.md +0 -185
- package/docs/providers/AWS.md +0 -32
- package/docs/providers/GEMINI.md +0 -33
- package/docs/providers/GROK.md +0 -25
- package/docs/providers/OPENAI.md +0 -39
- package/docs/providers/QWEN.md +0 -27
- package/docs/providers/ULTRAVOX.md +0 -29
- package/examples/01-basic/app.js +0 -196
- package/examples/01-basic/index.html +0 -27
- package/examples/02-advanced-dashboard/app.js +0 -465
- package/examples/02-advanced-dashboard/index.html +0 -200
- package/examples/02-advanced-dashboard/style.css +0 -501
- package/examples/03-smart-home/index.html +0 -377
- package/examples/04-customer-support/index.html +0 -474
- package/examples/sdk-usage.ts +0 -44
- package/integrations/n8n-nodes-aillomvox/README.md +0 -56
- package/integrations/n8n-nodes-aillomvox/credentials/AillomVoxApi.credentials.ts +0 -29
- package/integrations/n8n-nodes-aillomvox/dist/credentials/AillomVoxApi.credentials.js +0 -30
- package/integrations/n8n-nodes-aillomvox/dist/nodes/AillomVox/AillomVox.node.js +0 -219
- package/integrations/n8n-nodes-aillomvox/dist/nodes/AillomVox/aillomvox.svg +0 -6
- package/integrations/n8n-nodes-aillomvox/gulpfile.js +0 -10
- package/integrations/n8n-nodes-aillomvox/nodes/AillomVox/AillomVox.node.ts +0 -229
- package/integrations/n8n-nodes-aillomvox/nodes/AillomVox/aillomvox.svg +0 -6
- package/integrations/n8n-nodes-aillomvox/package-lock.json +0 -11741
- package/integrations/n8n-nodes-aillomvox/package.json +0 -56
- package/integrations/n8n-nodes-aillomvox/tsconfig.json +0 -32
- package/src/AillomVox.ts +0 -172
- package/src/index.ts +0 -2
- package/src/types.ts +0 -51
- package/tsconfig.json +0 -23
package/README.md
CHANGED
|
@@ -1,272 +1,179 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AillomVox client (TypeScript)
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/aillom-vox-client)
|
|
4
3
|
[](https://opensource.org/licenses/ISC)
|
|
5
4
|
[](https://nodejs.org/)
|
|
6
5
|
|
|
7
|
-
**
|
|
6
|
+
Official **browser + Node.js** SDK for [AillomVox](https://vox.aillom.com): one WebSocket to the gateway (`wss://vox.aillom.com/ws`), PCM16 streaming, transcripts, tools, and REST helpers for the public catalog (`GET /api/providers`) and pricing (`GET /api/pricing`).
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
Connect effortlessly to **OpenAI Realtime**, **Gemini Multimodal**, **AWS Nova**, **Qwen**, **Grok**, **UltraVox**, and **AillomVox** native models.
|
|
8
|
+
Companion server, dashboard, and adapter code ship from the Vox product monorepo; **this** repository is only the npm client surface.
|
|
11
9
|
|
|
12
10
|
---
|
|
13
11
|
|
|
14
|
-
##
|
|
12
|
+
## Installation
|
|
15
13
|
|
|
16
14
|
```bash
|
|
17
15
|
npm install aillom-vox-client
|
|
18
16
|
```
|
|
19
17
|
|
|
20
|
-
##
|
|
21
|
-
- [**Quick Start (SDK)**](#-quick-start-sdk) - The modern way
|
|
22
|
-
- [**Quick Start (WebSocket)**](#-quick-start-websocket) - The low-level way
|
|
23
|
-
- [**Examples**](#-examples) - Ready-to-use client implementations
|
|
24
|
-
- [**N8N Integration**](#-n8n-node) - Official AillomVox node for n8n
|
|
25
|
-
- [**Client Tools**](#-client-tools) - Add custom UI controls to your AI
|
|
26
|
-
- [**Voice Catalog**](docs/VOICES.md) - All voices across all providers
|
|
27
|
-
- [**Asterisk Integration**](docs/ASTERISK.md) - Complete guide for Asterisk 23/SIP
|
|
28
|
-
- [**Protocol Specification**](docs/PROTOCOL.md) - WebSocket messages and binary formats
|
|
29
|
-
- [**Supported Providers**](docs/PROVIDERS.md) - AI models and configuration options
|
|
30
|
-
- [**Troubleshooting**](docs/TROUBLESHOOTING.md) - Common errors and solutions
|
|
18
|
+
## Security considerations
|
|
31
19
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- **
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
- **Robust Audio**: Native PCM 16-bit at **8kHz**, **16kHz**, or **24kHz**
|
|
39
|
-
- **Client Tools**: Add custom UI controls (hangup, alerts, navigation) to your AI
|
|
40
|
-
- **15 Languages**: en, pt, es, fr, de, it, ja, zh, ko, hi, ar, ru, pl, nl, he
|
|
41
|
-
- **Event Driven**: Simple event emitter (`audio`, `transcript`, `interrupt`)
|
|
42
|
-
- **Enterprise Security**: Automatic key redaction and sanitized error messages
|
|
43
|
-
|
|
44
|
-
---
|
|
20
|
+
- **API keys are secrets.** Never commit real keys, never paste them into public tickets or client-side source that ships to browsers unless you accept that end users can extract them.
|
|
21
|
+
- **Browser apps:** a key embedded in frontend JavaScript or Web apps is visible in DevTools and bundled files. Safer patterns: your **backend** exchanges a session cookie or a **short-lived token** for voice access, or proxies the WebSocket with the real key on the server.
|
|
22
|
+
- **Do not put `apikey` in the WebSocket URL** (e.g. `wss://.../ws?apiKey=...`). That string is prone to leaking via server logs, reverse proxies, and referrer headers. The SDK uses `x-api-key` headers in Node.js and falls back to the first JSON **`config.apikey`** field in browsers, where custom WebSocket headers are unavailable.
|
|
23
|
+
- **`debug: true`:** logs structured config with `apikey` **redacted**, but may still log other inbound JSON; transcripts can contain **PII**. Keep `debug` off in production.
|
|
24
|
+
- **TLS:** use **`wss://`** against production (`wss://vox.aillom.com/ws`), not `ws://`, except on trusted local networks.
|
|
25
|
+
- **User data:** voice audio and transcripts flow through the gateway; document your own privacy policy and minimize what you log on the client.
|
|
45
26
|
|
|
46
|
-
##
|
|
27
|
+
## Documentation in this repo
|
|
47
28
|
|
|
48
|
-
|
|
29
|
+
| Doc | Purpose |
|
|
30
|
+
| :--- | :--- |
|
|
31
|
+
| [docs/PROTOCOL.md](docs/PROTOCOL.md) | WebSocket lifecycle, handshake JSON, PCM rules |
|
|
32
|
+
| [docs/PROVIDERS.md](docs/PROVIDERS.md) | Provider matrix, **public USD/min rate card**, `tts_engine` for `aillomvox` |
|
|
33
|
+
| [docs/VOICES.md](docs/VOICES.md) | Voice catalog notes |
|
|
34
|
+
| [docs/TOOLS.md](docs/TOOLS.md) | Client-side tools |
|
|
35
|
+
| [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) | Common failures |
|
|
49
36
|
|
|
50
|
-
|
|
51
|
-
| :--- | :--- | :--- | :--- |
|
|
52
|
-
| **AillomVox** | **$0.03** | 🚀 **Best Value** | High volume, Telephony, Support |
|
|
53
|
-
| **Gemini** | $0.06 | Standard | Google Gemini 2.5 Flash. Multimodal |
|
|
54
|
-
| **AWS** | $0.06 | Standard | AWS Nova Sonic 2. Enterprise |
|
|
55
|
-
| **Qwen** | $0.06 | Standard | Alibaba Qwen Omni 3. Cost-effective |
|
|
56
|
-
| **OpenAI** | $0.10 | Premium | GPT Realtime Mini. Logic-heavy |
|
|
57
|
-
| **Grok** | $0.10 | Premium | Grok Beta. Witty personality |
|
|
58
|
-
| **UltraVox** | $0.10 | Premium | High emotional intelligence |
|
|
59
|
-
|
|
60
|
-
> **Why AillomVox?**
|
|
61
|
-
> Native optimized pipeline delivers **sub-500ms latency** and **8kHz support** at less than half the cost. Choose from **65 voices** with dynamic mid-conversation switching.
|
|
37
|
+
Hosted docs: `https://vox.aillom.com/docs`
|
|
62
38
|
|
|
63
39
|
---
|
|
64
40
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
This repository contains multiple examples ranging from a minimal connection script to full-featured dashboards and creative use cases.
|
|
41
|
+
## What changed in v2.1
|
|
68
42
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
- The canonical WebSocket endpoint is **`wss://vox.aillom.com/ws`**. If you still have `wss://wss.aillom.com/ws` (or `https://wss.aillom.com`), the SDK migrates the host automatically via `normalizeWebSocketUrl()` and `migrateLegacyGatewayUrl()` — you can drop the legacy host from config whenever you like.
|
|
44
|
+
- `gatewayUrl` accepts either a WebSocket URL **or** an HTTPS origin; both are normalized.
|
|
45
|
+
- Auth now matches the live gateway: Node.js uses `x-api-key`; browser sessions keep using `config.apikey`.
|
|
46
|
+
- New helpers: `AillomVox.fetchProviders({ includeVoices })`, `AillomVox.fetchPricing()`, `AillomVox.fetchVoices()`, `AillomVox.fetchVoicePreview()`, `AillomVox.deleteVoice()`, `AillomVox.cloneVoiceDetailed()`, `sendHangup()`, `sendText()`, and `sendImage()`.
|
|
47
|
+
- Events: `playback_clear_buffer` (barge-in), `state`, `control`, and `raw` for advanced logging.
|
|
48
|
+
- Config: `workspaceId`, `firstMessage`, `farewellMessage`, `ttsEngine` (for `provider: 'aillomvox'`), and advanced timing knobs. Per-session `model` overrides are ignored by the current gateway; use `fetchProviders()` to inspect server defaults.
|
|
75
49
|
|
|
76
50
|
---
|
|
77
51
|
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
The easiest way to connect to AillomVox.
|
|
52
|
+
## Quick start
|
|
81
53
|
|
|
82
54
|
```typescript
|
|
83
55
|
import { AillomVox } from 'aillom-vox-client';
|
|
84
56
|
|
|
85
57
|
const client = new AillomVox({
|
|
86
|
-
apiKey:
|
|
87
|
-
|
|
88
|
-
|
|
58
|
+
apiKey: process.env.AILLOMVOX_KEY!,
|
|
59
|
+
provider: 'aillomvox',
|
|
60
|
+
ttsEngine: 'inworld',
|
|
61
|
+
voice: 'Aanya',
|
|
62
|
+
language: 'en-US',
|
|
63
|
+
sampleRate: 16000,
|
|
64
|
+
systemPrompt: 'You are a concise, professional assistant.',
|
|
65
|
+
firstMessage: 'Hello! How can I help you today?',
|
|
89
66
|
});
|
|
90
67
|
|
|
91
|
-
client.on('transcript', (
|
|
92
|
-
|
|
68
|
+
client.on('transcript', (t) => console.log(t.role, t.text));
|
|
69
|
+
client.on('audio', (pcm) => {
|
|
70
|
+
/* Int16 LE mono — play or forward */
|
|
93
71
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// Play chunk (ArrayBuffer)
|
|
72
|
+
client.on('playback_clear_buffer', () => {
|
|
73
|
+
/* Flush scheduled playback — user interrupted assistant */
|
|
97
74
|
});
|
|
98
75
|
|
|
99
76
|
await client.connect();
|
|
100
77
|
```
|
|
101
78
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
## 🔌 Quick Start (WebSocket)
|
|
105
|
-
|
|
106
|
-
If you prefer raw WebSockets (e.g. for Python, Go, or minimal JS):
|
|
107
|
-
|
|
108
|
-
```javascript
|
|
109
|
-
const ws = new WebSocket("wss://vox.aillom.com/ws");
|
|
79
|
+
### Load the live provider + voice tree
|
|
110
80
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
type: "config",
|
|
114
|
-
apikey: "YOUR_API_KEY",
|
|
115
|
-
provider: "aillomvox",
|
|
116
|
-
voice: "Edward"
|
|
117
|
-
}));
|
|
118
|
-
};
|
|
81
|
+
```typescript
|
|
82
|
+
import { AillomVox } from 'aillom-vox-client';
|
|
119
83
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
};
|
|
84
|
+
const catalog = await AillomVox.fetchProviders({ includeVoices: false });
|
|
85
|
+
const pricing = await AillomVox.fetchPricing();
|
|
86
|
+
console.log({ catalog, pricing });
|
|
125
87
|
```
|
|
126
88
|
|
|
127
89
|
---
|
|
128
90
|
|
|
129
|
-
|
|
91
|
+
### List pricing (USD / minute)
|
|
130
92
|
|
|
131
|
-
|
|
93
|
+
Published alongside the [marketing site](https://vox.aillom.com); full table in [docs/PROVIDERS.md](docs/PROVIDERS.md). The SDK exports the same rows as data:
|
|
132
94
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
| Voice | Gender | Style | Best For |
|
|
136
|
-
| :--- | :--- | :--- | :--- |
|
|
137
|
-
| **Edward** | Male | Fast-talking, emphatic | General purpose (default EN) |
|
|
138
|
-
| **Julia** | Female | Quirky, playful | Customer support |
|
|
139
|
-
| **Heitor** | Male | Composed, neutral | Portuguese (default PT) |
|
|
140
|
-
| **Maitê** | Female | Professional | Portuguese |
|
|
141
|
-
| **Ashley** | Female | Warm, natural | Sales, onboarding |
|
|
142
|
-
| **Craig** | Male | Refined, articulate | Enterprise, authority |
|
|
143
|
-
| **Diego** | Male | Soothing, gentle | Spanish (default ES) |
|
|
144
|
-
| **Luna** | Female | Calm, relaxing | Wellness, concierge |
|
|
95
|
+
```typescript
|
|
96
|
+
import { VOX_PROVIDER_RATECARD } from 'aillom-vox-client';
|
|
145
97
|
|
|
146
|
-
|
|
98
|
+
for (const row of VOX_PROVIDER_RATECARD) {
|
|
99
|
+
console.log(row.label, row.provider, row.usdPerMinute);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
147
102
|
|
|
148
|
-
|
|
103
|
+
The live endpoint is the preferred source for public list prices. Invoices can differ (credits, negotiated SKUs). Use the product billing UI as the contract.
|
|
149
104
|
|
|
150
|
-
**Client Tools** allow the AI to control your application's UI directly. When the AI decides to execute a tool, your app receives a callback and can respond.
|
|
151
105
|
|
|
152
|
-
###
|
|
106
|
+
### Current public providers and prices
|
|
153
107
|
|
|
154
|
-
|
|
155
|
-
{
|
|
156
|
-
"provider": "aillomvox",
|
|
157
|
-
"voice": "Edward",
|
|
158
|
-
"tools": [
|
|
159
|
-
{
|
|
160
|
-
"name": "hangup",
|
|
161
|
-
"description": "End the call when user says goodbye.",
|
|
162
|
-
"parameters": { "type": "object", "properties": {} }
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"name": "show_alert",
|
|
166
|
-
"description": "Show alert to user",
|
|
167
|
-
"parameters": {
|
|
168
|
-
"type": "object",
|
|
169
|
-
"properties": {
|
|
170
|
-
"message": { "type": "string", "description": "Alert message" }
|
|
171
|
-
},
|
|
172
|
-
"required": ["message"]
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
```
|
|
108
|
+
Use `AillomVox.fetchPricing()` for the live table. Current public list prices:
|
|
178
109
|
|
|
179
|
-
|
|
110
|
+
| Provider | Model / stack | USD/min |
|
|
111
|
+
| :--- | :--- | ---: |
|
|
112
|
+
| `aillomvox` | Soniox STT · Groq Llama 3.3 70B · selectable TTS | **0.04** |
|
|
113
|
+
| `aws` | nova-2-sonic | **0.06** |
|
|
114
|
+
| `gemini` | gemini-3.1-flash-live-preview | **0.06** |
|
|
115
|
+
| `qwen` | qwen3.5-omni-flash-realtime | **0.06** |
|
|
116
|
+
| `grok` | grok-voice-think-fast-1.0 | **0.10** |
|
|
117
|
+
| `openai` | gpt-realtime-mini | **0.10** |
|
|
118
|
+
| `ultravox` | ultravox-70B | **0.10** |
|
|
180
119
|
|
|
181
|
-
|
|
182
|
-
socket.onmessage = (event) => {
|
|
183
|
-
if (typeof event.data !== 'string') return;
|
|
184
|
-
const msg = JSON.parse(event.data);
|
|
185
|
-
|
|
186
|
-
if (msg.type === 'tool_call') {
|
|
187
|
-
console.log(`Tool requested: ${msg.name}`, msg.args);
|
|
188
|
-
|
|
189
|
-
let result = 'OK';
|
|
190
|
-
if (msg.name === 'hangup') {
|
|
191
|
-
disconnect();
|
|
192
|
-
result = 'Call ended';
|
|
193
|
-
} else if (msg.name === 'show_alert') {
|
|
194
|
-
alert(msg.args.message);
|
|
195
|
-
result = 'Alert displayed';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Always respond — AI waits for this (15s timeout)
|
|
199
|
-
socket.send(JSON.stringify({
|
|
200
|
-
type: 'tool_result',
|
|
201
|
-
call_id: msg.call_id,
|
|
202
|
-
result: result
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
```
|
|
120
|
+
For `provider: 'aillomvox'`, current TTS engines are `inworld`, `xai`, `lmnt`, `soniox`, `rime`, and `fish`. Cartesia is disabled in the public client docs for now; `aillomvoxmax` is deprecated.
|
|
207
121
|
|
|
208
122
|
---
|
|
209
123
|
|
|
210
|
-
##
|
|
211
|
-
|
|
212
|
-
### Audio Formats
|
|
124
|
+
## Raw WebSocket (no SDK)
|
|
213
125
|
|
|
214
126
|
```javascript
|
|
215
|
-
|
|
216
|
-
sample_rate: 16000, // 8000 (telephony), 16000 (standard), 24000 (high-quality)
|
|
217
|
-
// Audio is PCM 16-bit little-endian Mono
|
|
218
|
-
}
|
|
219
|
-
```
|
|
127
|
+
const ws = new WebSocket('wss://vox.aillom.com/ws');
|
|
220
128
|
|
|
221
|
-
|
|
129
|
+
ws.onopen = () => {
|
|
130
|
+
ws.send(JSON.stringify({
|
|
131
|
+
type: 'config',
|
|
132
|
+
apikey: 'YOUR_API_KEY',
|
|
133
|
+
provider: 'aillomvox',
|
|
134
|
+
tts_engine: 'inworld',
|
|
135
|
+
voice: 'Aanya',
|
|
136
|
+
language: 'en-US',
|
|
137
|
+
sample_rate: 16000,
|
|
138
|
+
system_prompt: 'You are a helpful assistant.',
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
222
141
|
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
}
|
|
142
|
+
ws.onmessage = (event) => {
|
|
143
|
+
if (event.data instanceof ArrayBuffer) {
|
|
144
|
+
/* PCM chunk */
|
|
145
|
+
}
|
|
146
|
+
};
|
|
227
147
|
```
|
|
228
148
|
|
|
229
|
-
|
|
149
|
+
---
|
|
230
150
|
|
|
231
|
-
|
|
151
|
+
## Examples
|
|
232
152
|
|
|
233
|
-
|
|
234
|
-
{
|
|
235
|
-
language: 'pt-BR',
|
|
236
|
-
voice: 'Heitor', // or 'Maitê' for female
|
|
237
|
-
system_prompt: 'Você é um assistente da Aillom. Seja conciso.',
|
|
238
|
-
first_message: 'Olá! Como posso ajudar?',
|
|
239
|
-
farewell_message: 'Obrigado por ligar. Até logo!'
|
|
240
|
-
}
|
|
241
|
-
```
|
|
153
|
+
See **[examples/README.md](examples/README.md)** for how to run the browser demos and the TypeScript sample (`npx serve`, `tsx`, API keys).
|
|
242
154
|
|
|
243
|
-
|
|
155
|
+
| Path | Description |
|
|
156
|
+
| :--- | :--- |
|
|
157
|
+
| [examples/sdk-usage.ts](examples/sdk-usage.ts) | TypeScript sample with catalog fetch + handlers |
|
|
158
|
+
| [examples/01-basic/](examples/01-basic/) | Minimal browser demo |
|
|
159
|
+
| [examples/02-advanced-dashboard/](examples/02-advanced-dashboard/) | Larger UI example |
|
|
160
|
+
| [examples/03-smart-home/](examples/03-smart-home/) | Tool-calling illustration |
|
|
161
|
+
| [examples/04-customer-support/](examples/04-customer-support/) | Support-style UI |
|
|
244
162
|
|
|
245
163
|
---
|
|
246
164
|
|
|
247
|
-
##
|
|
248
|
-
|
|
249
|
-
### Automatic Sanitization
|
|
250
|
-
- All error messages are stripped of sensitive data
|
|
251
|
-
- API keys are never exposed in logs
|
|
252
|
-
- Client cannot access server-side resources
|
|
165
|
+
## Voice clone (REST)
|
|
253
166
|
|
|
254
|
-
|
|
255
|
-
- **Concurrent**: 3 connections per user, 2 per API key
|
|
256
|
-
- **Max Duration**: 1-60 minutes per call
|
|
257
|
-
- **Default**: 5 minutes per session
|
|
258
|
-
- **Behavior**: Warning at 15s remaining, force disconnect at 0s
|
|
167
|
+
`AillomVox.cloneVoice(blob, apiKey, { gatewayUrl, workspaceId, providers, language, transcription })` posts to `/api/voices/clone` with `x-api-key` and returns the primary `voice_id`. Use `cloneVoiceDetailed()` when you need the per-provider clone result, and `deleteVoice()` to remove a workspace-owned clone. Production voice cloning is unlocked after the user's first paid top-up; the free $1.00 signup credit is for call testing.
|
|
259
168
|
|
|
260
169
|
---
|
|
261
170
|
|
|
262
|
-
##
|
|
171
|
+
## n8n
|
|
263
172
|
|
|
264
|
-
|
|
265
|
-
- **Issues**: [GitHub Issues](https://github.com/aillom/aillom-vox-client/issues)
|
|
266
|
-
- **Email**: contato@aillom.com.br
|
|
173
|
+
Community node under [integrations/n8n-nodes-aillomvox/](integrations/n8n-nodes-aillomvox/) (REST operations).
|
|
267
174
|
|
|
268
175
|
---
|
|
269
176
|
|
|
270
|
-
##
|
|
177
|
+
## License
|
|
271
178
|
|
|
272
179
|
ISC © Aillom Technologies
|
package/dist/AillomVox.d.ts
CHANGED
|
@@ -1,36 +1,95 @@
|
|
|
1
|
-
import { AillomVoxConfig,
|
|
1
|
+
import { AillomVoxConfig, CloneVoiceOptions, CloneVoiceResult, DeleteVoiceOptions, ErrorEvent, EventHandler, ProvidersCatalogOptions, StateEvent, ToolCallEvent, TranscriptEvent, VoicePreviewOptions, VoicesCatalogOptions } from './types';
|
|
2
|
+
import WebSocket from 'isomorphic-ws';
|
|
3
|
+
export type ClientEvent = 'audio' | 'transcript' | 'tool_call' | 'error' | 'connected' | 'disconnected' | 'interruption' | 'playback_clear_buffer' | 'state' | 'control' | 'raw';
|
|
4
|
+
export interface VoxClientEventMap {
|
|
5
|
+
audio: ArrayBuffer | Buffer;
|
|
6
|
+
transcript: TranscriptEvent;
|
|
7
|
+
tool_call: ToolCallEvent;
|
|
8
|
+
error: ErrorEvent | WebSocket.ErrorEvent | unknown;
|
|
9
|
+
connected: Record<string, never>;
|
|
10
|
+
disconnected: {
|
|
11
|
+
code?: number;
|
|
12
|
+
reason?: string;
|
|
13
|
+
};
|
|
14
|
+
interruption: Record<string, never>;
|
|
15
|
+
playback_clear_buffer: Record<string, never>;
|
|
16
|
+
state: StateEvent;
|
|
17
|
+
control: Record<string, unknown>;
|
|
18
|
+
raw: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Browser or Node.js WebSocket client for the AillomVox voice gateway.
|
|
22
|
+
*
|
|
23
|
+
* Protocol summary: after `connect()`, the first outbound message must be the JSON `config`
|
|
24
|
+
* handshake (sent automatically). All further outbound binary messages are PCM16 mono chunks.
|
|
25
|
+
*/
|
|
2
26
|
export declare class AillomVox {
|
|
3
27
|
private ws;
|
|
4
|
-
private config;
|
|
5
|
-
private eventListeners;
|
|
28
|
+
private readonly config;
|
|
29
|
+
private readonly eventListeners;
|
|
6
30
|
private isConnected;
|
|
7
|
-
private url;
|
|
31
|
+
private readonly url;
|
|
8
32
|
constructor(config: AillomVoxConfig);
|
|
33
|
+
/** Resolved WebSocket URL after normalization. */
|
|
34
|
+
get websocketUrl(): string;
|
|
35
|
+
/** True when the underlying WebSocket is open. */
|
|
36
|
+
get connected(): boolean;
|
|
9
37
|
/**
|
|
10
|
-
* Connects to the
|
|
38
|
+
* Connects to the gateway and sends the `config` handshake as the first message.
|
|
11
39
|
*/
|
|
12
40
|
connect(): Promise<void>;
|
|
41
|
+
private createWebSocket;
|
|
42
|
+
private shouldUseHeaderAuth;
|
|
43
|
+
private shouldSendHandshakeApiKey;
|
|
13
44
|
/**
|
|
14
|
-
*
|
|
45
|
+
* Send microphone capture to the model. PCM16 LE mono at the configured `sampleRate`.
|
|
15
46
|
*/
|
|
16
47
|
sendAudio(chunk: ArrayBuffer | Int16Array | Buffer): void;
|
|
17
48
|
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
sendToolResult(callId: string, result: any): void;
|
|
21
|
-
/**
|
|
22
|
-
* Disconnects the session
|
|
49
|
+
* Reply to a `tool_call` event within 15 seconds or the model may stall.
|
|
23
50
|
*/
|
|
51
|
+
sendToolResult(callId: string, result: unknown): void;
|
|
52
|
+
/** Ask the server to end the call (mirrors dashboard playground). */
|
|
53
|
+
sendHangup(): void;
|
|
54
|
+
/** Send a text turn over the same WebSocket session. */
|
|
55
|
+
sendText(text: string): void;
|
|
56
|
+
/** Send image payload data for gateways with vision support. */
|
|
57
|
+
sendImage(data: string | Record<string, unknown>): void;
|
|
58
|
+
private sendJson;
|
|
24
59
|
disconnect(): void;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
on(event: 'transcript', handler: (data: TranscriptEvent) => void): void;
|
|
30
|
-
on(event: 'tool_call', handler: (data: ToolCallEvent) => void): void;
|
|
31
|
-
on(event: 'error', handler: (error: any) => void): void;
|
|
32
|
-
on(event: 'connected' | 'disconnected' | 'interruption', handler: (data: any) => void): void;
|
|
60
|
+
on<K extends keyof VoxClientEventMap>(event: K, handler: EventHandler<VoxClientEventMap[K]>): void;
|
|
61
|
+
on(event: string, handler: EventHandler): void;
|
|
62
|
+
off<K extends keyof VoxClientEventMap>(event: K, handler: EventHandler<VoxClientEventMap[K]>): void;
|
|
63
|
+
off(event: string, handler: EventHandler): void;
|
|
33
64
|
private sendConfig;
|
|
34
65
|
private handleMessage;
|
|
35
66
|
private emit;
|
|
67
|
+
/**
|
|
68
|
+
* `GET /api/providers` — models and nested voices (public; optional auth for workspace scoping).
|
|
69
|
+
*/
|
|
70
|
+
static fetchProviders(options?: ProvidersCatalogOptions): Promise<unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* `GET /api/pricing` — public USD/min rate card from the live gateway.
|
|
73
|
+
*/
|
|
74
|
+
static fetchPricing(options?: {
|
|
75
|
+
baseUrl?: string;
|
|
76
|
+
}): Promise<unknown>;
|
|
77
|
+
/**
|
|
78
|
+
* `GET /api/voices` — optional provider filter matches dashboard catalog keys.
|
|
79
|
+
*/
|
|
80
|
+
static fetchVoices(options: VoicesCatalogOptions): Promise<unknown>;
|
|
81
|
+
/** Build the public `/api/voices/preview` URL for a provider voice. */
|
|
82
|
+
static buildVoicePreviewUrl(options: VoicePreviewOptions): string;
|
|
83
|
+
/** `GET /api/voices/preview` — returns an audio Blob for UI preview playback. */
|
|
84
|
+
static fetchVoicePreview(options: VoicePreviewOptions): Promise<Blob>;
|
|
85
|
+
/** `DELETE /api/voices/:id` — removes a workspace-owned cloned voice. */
|
|
86
|
+
static deleteVoice(voiceId: string, apiKey: string, options?: DeleteVoiceOptions): Promise<unknown>;
|
|
87
|
+
/**
|
|
88
|
+
* Upload a short clean recording to create a cloned voice handle.
|
|
89
|
+
*/
|
|
90
|
+
static cloneVoice(clip: Blob, apiKey: string, options?: CloneVoiceOptions): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Upload a short clean recording and return the full multi-provider clone response.
|
|
93
|
+
*/
|
|
94
|
+
static cloneVoiceDetailed(clip: Blob, apiKey: string, options?: CloneVoiceOptions): Promise<CloneVoiceResult>;
|
|
36
95
|
}
|