@deepgram/sdk 4.9.0 → 4.10.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 +155 -331
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +11 -2
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types/DeepgramSource.d.ts +1 -1
- package/dist/main/lib/types/DeepgramSource.d.ts.map +1 -1
- package/dist/main/lib/types/GrantTokenSchema.d.ts +10 -0
- package/dist/main/lib/types/GrantTokenSchema.d.ts.map +1 -0
- package/dist/main/lib/types/GrantTokenSchema.js +3 -0
- package/dist/main/lib/types/GrantTokenSchema.js.map +1 -0
- package/dist/main/lib/types/index.d.ts +1 -0
- package/dist/main/lib/types/index.d.ts.map +1 -1
- package/dist/main/lib/types/index.js +1 -0
- package/dist/main/lib/types/index.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/packages/AbstractRestClient.d.ts +1 -1
- package/dist/main/packages/AbstractRestClient.d.ts.map +1 -1
- package/dist/main/packages/AuthRestClient.d.ts +3 -1
- package/dist/main/packages/AuthRestClient.d.ts.map +1 -1
- package/dist/main/packages/AuthRestClient.js +6 -2
- package/dist/main/packages/AuthRestClient.js.map +1 -1
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +11 -2
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types/DeepgramSource.d.ts +1 -1
- package/dist/module/lib/types/DeepgramSource.d.ts.map +1 -1
- package/dist/module/lib/types/GrantTokenSchema.d.ts +10 -0
- package/dist/module/lib/types/GrantTokenSchema.d.ts.map +1 -0
- package/dist/module/lib/types/GrantTokenSchema.js +2 -0
- package/dist/module/lib/types/GrantTokenSchema.js.map +1 -0
- package/dist/module/lib/types/index.d.ts +1 -0
- package/dist/module/lib/types/index.d.ts.map +1 -1
- package/dist/module/lib/types/index.js +1 -0
- package/dist/module/lib/types/index.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/packages/AbstractRestClient.d.ts +1 -1
- package/dist/module/packages/AbstractRestClient.d.ts.map +1 -1
- package/dist/module/packages/AuthRestClient.d.ts +3 -1
- package/dist/module/packages/AuthRestClient.d.ts.map +1 -1
- package/dist/module/packages/AuthRestClient.js +6 -2
- package/dist/module/packages/AuthRestClient.js.map +1 -1
- package/dist/umd/deepgram.js +1 -2
- package/package.json +1 -1
- package/src/lib/helpers.ts +14 -2
- package/src/lib/types/DeepgramSource.ts +1 -1
- package/src/lib/types/GrantTokenSchema.ts +9 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/version.ts +1 -1
- package/src/packages/AbstractRestClient.ts +1 -1
- package/src/packages/AuthRestClient.ts +7 -3
- package/dist/umd/deepgram.js.LICENSE.txt +0 -10
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# Deepgram JavaScript SDK
|
|
2
2
|
|
|
3
|
-
[](https://discord.gg/deepgram) [](https://github.com/deepgram/node-sdk/actions/workflows/CI.yml) [](https://www.npmjs.com/package/@deepgram/sdk) [](CODE_OF_CONDUCT.md)
|
|
4
4
|
|
|
5
5
|
> 🎯 **Development Setup**: This project uses [Corepack](https://nodejs.org/api/corepack.html) for package manager consistency. Run `corepack enable` once, then use `pnpm` commands normally. See [DEVELOPMENT.md](./DEVELOPMENT.md) for details.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
<!-- TOC -->
|
|
9
8
|
- [Documentation](#documentation)
|
|
10
9
|
- [Migrating from earlier versions](#migrating-from-earlier-versions)
|
|
11
10
|
- [V2 to V3](#v2-to-v3)
|
|
@@ -17,32 +16,31 @@ Isomorphic Javascript client for Deepgram's automated speech recognition APIs.
|
|
|
17
16
|
- [Initialization](#initialization)
|
|
18
17
|
- [Getting an API Key](#getting-an-api-key)
|
|
19
18
|
- [Scoped Configuration](#scoped-configuration)
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
19
|
+
- [Global Defaults](#global-defaults)
|
|
20
|
+
- [Namespace-specific Configurations](#namespace-specific-configurations)
|
|
21
|
+
- [Transport Options](#transport-options)
|
|
22
|
+
- [Examples](#examples)
|
|
24
23
|
- [Change the API url used for all SDK methods](#change-the-api-url-used-for-all-sdk-methods)
|
|
25
|
-
- [Change the API url used for transcription only](#change-the-api-url-used-for-transcription-only)
|
|
26
24
|
- [Change the API url used for the Voice Agent websocket](#change-the-api-url-used-for-the-voice-agent-websocket)
|
|
25
|
+
- [Change the API url used for transcription only](#change-the-api-url-used-for-transcription-only)
|
|
27
26
|
- [Override fetch transmitter](#override-fetch-transmitter)
|
|
28
27
|
- [Proxy requests in the browser](#proxy-requests-in-the-browser)
|
|
29
28
|
- [Set custom headers for fetch](#set-custom-headers-for-fetch)
|
|
30
|
-
- [
|
|
29
|
+
- [Browser Usage](#browser-usage)
|
|
30
|
+
- [Transcription](#transcription)
|
|
31
31
|
- [Remote Files](#remote-files)
|
|
32
32
|
- [Local Files](#local-files)
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [
|
|
36
|
-
- [Local Files](#local-files-1)
|
|
37
|
-
- [Browser](#browser-1)
|
|
38
|
-
- [Streaming Audio](#streaming-audio)
|
|
39
|
-
- [Transcribing to captions](#transcribing-to-captions)
|
|
33
|
+
- [Callbacks / Async](#callbacks--async)
|
|
34
|
+
- [Live Transcription (WebSocket)](#live-transcription-websocket)
|
|
35
|
+
- [Captions](#captions)
|
|
40
36
|
- [Voice Agent](#voice-agent)
|
|
41
|
-
- [Text to Speech
|
|
42
|
-
- [
|
|
37
|
+
- [Text to Speech](#text-to-speech)
|
|
38
|
+
- [Single-Request](#single-request)
|
|
39
|
+
- [Continuous Text Stream (WebSocket)](#continuous-text-stream-websocket)
|
|
43
40
|
- [Text Intelligence](#text-intelligence)
|
|
44
41
|
- [Authentication](#authentication)
|
|
45
42
|
- [Get Token Details](#get-token-details)
|
|
43
|
+
- [Grant Token](#grant-token)
|
|
46
44
|
- [Projects](#projects)
|
|
47
45
|
- [Get Projects](#get-projects)
|
|
48
46
|
- [Get Project](#get-project)
|
|
@@ -69,6 +67,7 @@ Isomorphic Javascript client for Deepgram's automated speech recognition APIs.
|
|
|
69
67
|
- [Get Request](#get-request)
|
|
70
68
|
- [Summarize Usage](#summarize-usage)
|
|
71
69
|
- [Get Fields](#get-fields)
|
|
70
|
+
- [Summarize Usage](#summarize-usage)
|
|
72
71
|
- [Billing](#billing)
|
|
73
72
|
- [Get All Balances](#get-all-balances)
|
|
74
73
|
- [Get Balance](#get-balance)
|
|
@@ -84,6 +83,7 @@ Isomorphic Javascript client for Deepgram's automated speech recognition APIs.
|
|
|
84
83
|
- [Development and Contributing](#development-and-contributing)
|
|
85
84
|
- [Debugging and making changes locally](#debugging-and-making-changes-locally)
|
|
86
85
|
- [Getting Help](#getting-help)
|
|
86
|
+
<!-- /TOC -->
|
|
87
87
|
|
|
88
88
|
## Documentation
|
|
89
89
|
|
|
@@ -105,12 +105,22 @@ The Voice Agent interfaces have been updated to use the new Voice Agent V1 API.
|
|
|
105
105
|
|
|
106
106
|
## Installation
|
|
107
107
|
|
|
108
|
-
You can install this SDK directly from [npm](https://www.npmjs.com/package/@deepgram/sdk).
|
|
108
|
+
You can install this SDK directly from [[npm](https://www.npmjs.com/package/@deepgram/sdk)](https://www.npmjs.com/package/@deepgram/sdk).
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
111
|
npm install @deepgram/sdk
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
or
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm install @deepgram/sdk
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
or
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
yarn add @deepgram/sdk
|
|
114
124
|
```
|
|
115
125
|
|
|
116
126
|
### UMD
|
|
@@ -132,9 +142,9 @@ Then you can use it from a global deepgram variable:
|
|
|
132
142
|
```html
|
|
133
143
|
<script>
|
|
134
144
|
const { createClient } = deepgram;
|
|
135
|
-
const
|
|
145
|
+
const deepgramClient = createClient("deepgram-api-key");
|
|
136
146
|
|
|
137
|
-
console.log("Deepgram
|
|
147
|
+
console.log("Deepgram client instance: ", deepgramClient);
|
|
138
148
|
// ...
|
|
139
149
|
</script>
|
|
140
150
|
```
|
|
@@ -146,9 +156,9 @@ You can now use type="module" `<script>`s to import deepgram from CDNs, like:
|
|
|
146
156
|
```html
|
|
147
157
|
<script type="module">
|
|
148
158
|
import { createClient } from "https://cdn.jsdelivr.net/npm/@deepgram/sdk/+esm";
|
|
149
|
-
const
|
|
159
|
+
const deepgramClient = createClient("deepgram-api-key");
|
|
150
160
|
|
|
151
|
-
console.log("Deepgram
|
|
161
|
+
console.log("Deepgram client instance: ", deepgramClient);
|
|
152
162
|
// ...
|
|
153
163
|
</script>
|
|
154
164
|
```
|
|
@@ -162,7 +172,7 @@ import { createClient } from "@deepgram/sdk";
|
|
|
162
172
|
// - or -
|
|
163
173
|
// const { createClient } = require("@deepgram/sdk");
|
|
164
174
|
|
|
165
|
-
const
|
|
175
|
+
const deepgramClient = createClient(DEEPGRAM_API_KEY);
|
|
166
176
|
```
|
|
167
177
|
|
|
168
178
|
### Getting an API Key
|
|
@@ -173,18 +183,18 @@ const deepgram = createClient(DEEPGRAM_API_KEY);
|
|
|
173
183
|
|
|
174
184
|
The SDK supports scoped configuration. You'll be able to configure various aspects of each namespace of the SDK from the initialization. Below outlines a flexible and customizable configuration system for the Deepgram SDK. Here's how the namespace configuration works:
|
|
175
185
|
|
|
176
|
-
###
|
|
186
|
+
### Global Defaults
|
|
177
187
|
|
|
178
188
|
- The `global` namespace serves as the foundational configuration applicable across all other namespaces unless overridden.
|
|
179
189
|
- Includes general settings like URL and headers applicable for all API calls.
|
|
180
190
|
- If no specific configurations are provided for other namespaces, the `global` defaults are used.
|
|
181
191
|
|
|
182
|
-
###
|
|
192
|
+
### Namespace-specific Configurations
|
|
183
193
|
|
|
184
194
|
- Each namespace (`listen`, `manage`, `onprem`, `read`, `speak`) can have its specific configurations which override the `global` settings within their respective scopes.
|
|
185
195
|
- Allows for detailed control over different parts of the application interacting with various Deepgram API endpoints.
|
|
186
196
|
|
|
187
|
-
###
|
|
197
|
+
### Transport Options
|
|
188
198
|
|
|
189
199
|
- Configurations for both `fetch` and `websocket` can be specified under each namespace, allowing different transport mechanisms for different operations.
|
|
190
200
|
- For example, the `fetch` configuration can have its own URL and proxy settings distinct from the `websocket`.
|
|
@@ -192,7 +202,7 @@ The SDK supports scoped configuration. You'll be able to configure various aspec
|
|
|
192
202
|
|
|
193
203
|
This configuration system enables robust customization where defaults provide a foundation, but every aspect of the client's interaction with the API can be finely controlled and tailored to specific needs through namespace-specific settings. This enhances the maintainability and scalability of the application by localizing configurations to their relevant contexts.
|
|
194
204
|
|
|
195
|
-
###
|
|
205
|
+
### Examples
|
|
196
206
|
|
|
197
207
|
#### Change the API url used for all SDK methods
|
|
198
208
|
|
|
@@ -203,7 +213,7 @@ import { createClient } from "@deepgram/sdk";
|
|
|
203
213
|
// - or -
|
|
204
214
|
// const { createClient } = require("@deepgram/sdk");
|
|
205
215
|
|
|
206
|
-
const
|
|
216
|
+
const deepgramClient = createClient(DEEPGRAM_API_KEY, {
|
|
207
217
|
global: { fetch: { options: { url: "https://api.beta.deepgram.com" } } },
|
|
208
218
|
});
|
|
209
219
|
```
|
|
@@ -217,7 +227,7 @@ import { createClient } from "@deepgram/sdk";
|
|
|
217
227
|
// - or -
|
|
218
228
|
// const { createClient } = require("@deepgram/sdk");
|
|
219
229
|
|
|
220
|
-
const
|
|
230
|
+
const deepgramClient = createClient(DEEPGRAM_API_KEY, {
|
|
221
231
|
global: { websocket: { options: { url: "ws://localhost:8080" } } },
|
|
222
232
|
});
|
|
223
233
|
```
|
|
@@ -231,7 +241,7 @@ import { createClient } from "@deepgram/sdk";
|
|
|
231
241
|
// - or -
|
|
232
242
|
// const { createClient } = require("@deepgram/sdk");
|
|
233
243
|
|
|
234
|
-
const
|
|
244
|
+
const deepgramClient = createClient(DEEPGRAM_API_KEY, {
|
|
235
245
|
listen: { fetch: { options: { url: "http://localhost:8080" } } },
|
|
236
246
|
});
|
|
237
247
|
```
|
|
@@ -249,7 +259,7 @@ const yourFetch = async () => {
|
|
|
249
259
|
return Response("...etc");
|
|
250
260
|
};
|
|
251
261
|
|
|
252
|
-
const
|
|
262
|
+
const deepgramClient = createClient(DEEPGRAM_API_KEY, {
|
|
253
263
|
global: { fetch: { client: yourFetch } },
|
|
254
264
|
});
|
|
255
265
|
```
|
|
@@ -261,7 +271,7 @@ This SDK now works in the browser. If you'd like to make REST-based requests (pr
|
|
|
261
271
|
```js
|
|
262
272
|
import { createClient } from "@deepgram/sdk";
|
|
263
273
|
|
|
264
|
-
const
|
|
274
|
+
const deepgramClient = createClient("proxy", {
|
|
265
275
|
global: { fetch: { options: { proxy: { url: "http://localhost:8080" } } } },
|
|
266
276
|
});
|
|
267
277
|
```
|
|
@@ -279,218 +289,107 @@ Useful for many things.
|
|
|
279
289
|
```js
|
|
280
290
|
import { createClient } from "@deepgram/sdk";
|
|
281
291
|
|
|
282
|
-
const
|
|
292
|
+
const deepgramClient = createClient("proxy", {
|
|
283
293
|
global: { fetch: { options: { headers: { "x-custom-header": "foo" } } } },
|
|
284
294
|
});
|
|
285
295
|
```
|
|
286
296
|
|
|
287
|
-
##
|
|
288
|
-
|
|
289
|
-
### Remote Files
|
|
290
|
-
|
|
291
|
-
Transcribe audio from a URL.
|
|
292
|
-
|
|
293
|
-
```js
|
|
294
|
-
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
|
|
295
|
-
{
|
|
296
|
-
url: "https://dpgr.am/spacewalk.wav",
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
model: "nova",
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
```
|
|
297
|
+
## Browser Usage
|
|
303
298
|
|
|
304
|
-
|
|
299
|
+
To use this SDK in the browser, check out [UMD](#umd) and/or [ESM](#esm) initialisation.
|
|
305
300
|
|
|
306
|
-
|
|
301
|
+
Also see [proxy requests in the browser](#proxy-requests-in-the-browser) if you're planning to make RESTful requests to our API.
|
|
307
302
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
```js
|
|
311
|
-
const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
|
|
312
|
-
fs.createReadStream("./examples/spacewalk.wav"),
|
|
313
|
-
{
|
|
314
|
-
model: "nova",
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
or
|
|
320
|
-
|
|
321
|
-
```js
|
|
322
|
-
const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
|
|
323
|
-
fs.readFileSync("./examples/spacewalk.wav"),
|
|
324
|
-
{
|
|
325
|
-
model: "nova",
|
|
326
|
-
}
|
|
327
|
-
);
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
331
|
-
|
|
332
|
-
### Browser
|
|
333
|
-
|
|
334
|
-
Transcribe audio from a file in the browser.
|
|
335
|
-
|
|
336
|
-
```js
|
|
337
|
-
const transcribeFile = async () => {
|
|
338
|
-
const { result, error } = await _deepgram.listen.prerecorded.transcribeFile(
|
|
339
|
-
fs.readFileSync("./examples/nasa.mp4"),
|
|
340
|
-
{
|
|
341
|
-
model: "nova",
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
};
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
348
|
-
|
|
349
|
-
[See our Example for more info](./examples/browser-prerecorded/index.html).
|
|
350
|
-
|
|
351
|
-
## Pre-Recorded (Asynchronous / Callbacks)
|
|
303
|
+
## Transcription
|
|
352
304
|
|
|
353
305
|
### Remote Files
|
|
354
306
|
|
|
355
307
|
Transcribe audio from a URL.
|
|
356
308
|
|
|
357
309
|
```js
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
const { result, error } = await deepgram.listen.prerecorded.transcribeUrlCallback(
|
|
361
|
-
{
|
|
362
|
-
url: "https://dpgr.am/spacewalk.wav",
|
|
363
|
-
},
|
|
364
|
-
new CallbackUrl("http://callback/endpoint"),
|
|
310
|
+
const { result, error } = await deepgramClient.listen.prerecorded.transcribeUrl(
|
|
311
|
+
{ url: "https://dpgr.am/spacewalk.wav" },
|
|
365
312
|
{
|
|
366
|
-
model: "nova",
|
|
313
|
+
model: "nova-3",
|
|
314
|
+
// pre-recorded transcription options
|
|
367
315
|
}
|
|
368
316
|
);
|
|
369
317
|
```
|
|
370
318
|
|
|
371
319
|
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
372
320
|
|
|
373
|
-
[See our Example for more info](./examples/node-prerecorded/index.js).
|
|
374
|
-
|
|
375
321
|
### Local Files
|
|
376
322
|
|
|
377
323
|
Transcribe audio from a file.
|
|
378
324
|
|
|
379
325
|
```js
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const { result, error } = await deepgram.listen.prerecorded.transcribeFileCallback(
|
|
326
|
+
const { result, error } = await deepgramClient.listen.prerecorded.transcribeFile(
|
|
383
327
|
fs.createReadStream("./examples/spacewalk.wav"),
|
|
384
|
-
new CallbackUrl("http://callback/endpoint"),
|
|
385
328
|
{
|
|
386
|
-
model: "nova",
|
|
329
|
+
model: "nova-3",
|
|
330
|
+
// pre-recorded transcription options
|
|
387
331
|
}
|
|
388
332
|
);
|
|
389
333
|
```
|
|
390
334
|
|
|
391
|
-
|
|
335
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
336
|
+
|
|
337
|
+
### Callbacks / Async
|
|
338
|
+
|
|
339
|
+
We have a `Callback` version of both `transcribeFile` and `transcribeUrl`, which simply takes a `CallbackUrl` class.
|
|
392
340
|
|
|
393
341
|
```js
|
|
394
342
|
import { CallbackUrl } from "@deepgram/sdk";
|
|
395
343
|
|
|
396
|
-
const { result, error } = await
|
|
397
|
-
|
|
344
|
+
const { result, error } = await deepgramClient.listen.prerecorded.transcribeUrlCallback(
|
|
345
|
+
{ url: "https://dpgr.am/spacewalk.wav" },
|
|
398
346
|
new CallbackUrl("http://callback/endpoint"),
|
|
399
347
|
{
|
|
400
|
-
model: "nova",
|
|
348
|
+
model: "nova-3",
|
|
349
|
+
// pre-recorded transcription options
|
|
401
350
|
}
|
|
402
351
|
);
|
|
403
352
|
```
|
|
404
353
|
|
|
405
354
|
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
406
355
|
|
|
407
|
-
###
|
|
408
|
-
|
|
409
|
-
Transcribe audio from a URL in the browser.
|
|
410
|
-
|
|
411
|
-
```js
|
|
412
|
-
// browser code
|
|
413
|
-
const transcribeUrl = async () => {
|
|
414
|
-
const { result, error } = await _deepgram.listen.prerecorded.transcribeUrl(
|
|
415
|
-
{
|
|
416
|
-
url: "https://dpgr.am/spacewalk.wav",
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
model: "nova",
|
|
420
|
-
}
|
|
421
|
-
);
|
|
422
|
-
};
|
|
423
|
-
// browser code
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
427
|
-
|
|
428
|
-
[See our Example for more info](./examples/browser-prerecorded/index.html).
|
|
356
|
+
### Live Transcription (WebSocket)
|
|
429
357
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
Transcribe streaming audio.
|
|
358
|
+
Connect to our websocket and transcribe live streaming audio.
|
|
433
359
|
|
|
434
360
|
```js
|
|
435
|
-
const
|
|
361
|
+
const deepgramConnection = deepgramClient.listen.live({
|
|
362
|
+
model: "nova-3",
|
|
363
|
+
// live transcription options
|
|
364
|
+
});
|
|
436
365
|
|
|
437
|
-
|
|
438
|
-
|
|
366
|
+
deepgramConnection.on(LiveTranscriptionEvents.Open, () => {
|
|
367
|
+
deepgramConnection.on(LiveTranscriptionEvents.Transcript, (data) => {
|
|
439
368
|
console.log(data);
|
|
440
369
|
});
|
|
441
370
|
|
|
442
371
|
source.addListener("got-some-audio", async (event) => {
|
|
443
|
-
|
|
372
|
+
deepgramConnection.send(event.raw_audio_data);
|
|
444
373
|
});
|
|
445
374
|
});
|
|
446
375
|
```
|
|
447
376
|
|
|
448
377
|
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen-streaming).
|
|
449
378
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
### Browser
|
|
379
|
+
### Captions
|
|
453
380
|
|
|
454
|
-
|
|
381
|
+
Convert deepgram transcriptions to captions.
|
|
455
382
|
|
|
456
383
|
```js
|
|
457
|
-
|
|
384
|
+
import { webvtt, srt } from "@deepgram/sdk";
|
|
458
385
|
|
|
459
|
-
const
|
|
386
|
+
const { result, error } = await deepgramClient.listen.prerecorded.transcribeUrl({
|
|
460
387
|
model: "nova-3",
|
|
461
|
-
|
|
462
|
-
smart_format: true,
|
|
463
|
-
interim_results: true,
|
|
464
|
-
utterance_end_ms: 1000,
|
|
465
|
-
vad_events: true,
|
|
466
|
-
endpointing: 300,
|
|
388
|
+
// pre-recorded transcription options
|
|
467
389
|
});
|
|
468
390
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen-streaming).
|
|
473
|
-
|
|
474
|
-
[See Our Example for more info](https://github.com/deepgram-devs/js-live-example).
|
|
475
|
-
|
|
476
|
-
## Transcribing to captions
|
|
477
|
-
|
|
478
|
-
Transcribe audio to captions.
|
|
479
|
-
|
|
480
|
-
```js
|
|
481
|
-
import { webvtt /* , srt */ } from "@deepgram/captions";
|
|
482
|
-
|
|
483
|
-
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
|
|
484
|
-
{
|
|
485
|
-
url: "https://dpgr.am/spacewalk.wav",
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
model: "nova",
|
|
489
|
-
}
|
|
490
|
-
);
|
|
491
|
-
|
|
492
|
-
const vttOutput = webvtt(result);
|
|
493
|
-
// const srtOutput = srt(result);
|
|
391
|
+
const vttResult = webvtt(result);
|
|
392
|
+
const srtResult = srt(result);
|
|
494
393
|
```
|
|
495
394
|
|
|
496
395
|
[See our standalone captions library for more information](https://github.com/deepgram/deepgram-node-captions).
|
|
@@ -500,136 +399,71 @@ const vttOutput = webvtt(result);
|
|
|
500
399
|
Configure a Voice Agent.
|
|
501
400
|
|
|
502
401
|
```js
|
|
503
|
-
import { createClient } from "@deepgram/sdk";
|
|
504
402
|
import { AgentEvents } from "@deepgram/sdk";
|
|
505
403
|
|
|
506
|
-
const deepgram = createClient(DEEPGRAM_API_KEY);
|
|
507
|
-
|
|
508
404
|
// Create an agent connection
|
|
509
|
-
const
|
|
405
|
+
const deepgramConnection = deepgramClient.agent();
|
|
510
406
|
|
|
511
407
|
// Set up event handlers
|
|
512
|
-
|
|
408
|
+
deepgramConnection.on(AgentEvents.Open, () => {
|
|
513
409
|
console.log("Connection opened");
|
|
514
410
|
|
|
515
|
-
//
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
input: {
|
|
519
|
-
encoding: "linear16",
|
|
520
|
-
sampleRate: 24000,
|
|
521
|
-
},
|
|
522
|
-
output: {
|
|
523
|
-
encoding: "mp3",
|
|
524
|
-
sample_rate: 24000,
|
|
525
|
-
bitrate: 48000,
|
|
526
|
-
container: "none",
|
|
527
|
-
},
|
|
528
|
-
},
|
|
529
|
-
agent: {
|
|
530
|
-
language: "en",
|
|
531
|
-
listen: {
|
|
532
|
-
provider: {
|
|
533
|
-
type: "deepgram",
|
|
534
|
-
model: "nova-3",
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
think: {
|
|
538
|
-
provider: {
|
|
539
|
-
type: "open_ai",
|
|
540
|
-
model: "gpt-4-mini",
|
|
541
|
-
temperature: 0.7,
|
|
542
|
-
},
|
|
543
|
-
prompt: "You are a helpful AI assistant. Keep responses brief and friendly.",
|
|
544
|
-
},
|
|
545
|
-
speak: {
|
|
546
|
-
provider: {
|
|
547
|
-
type: "deepgram",
|
|
548
|
-
model: "aura-2-thalia-en",
|
|
549
|
-
},
|
|
550
|
-
},
|
|
551
|
-
},
|
|
411
|
+
// Set up event handlers
|
|
412
|
+
deepgramConnection.on(AgentEvents.ConversationText, (data) => {
|
|
413
|
+
console.log(data);
|
|
552
414
|
});
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
// Handle agent responses
|
|
556
|
-
agent.on(AgentEvents.AgentStartedSpeaking, (data) => {
|
|
557
|
-
console.log("Agent started speaking:", data["total_latency"]);
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
agent.on(AgentEvents.ConversationText, (message) => {
|
|
561
|
-
console.log(`${message.role} said: ${message.content}`);
|
|
562
|
-
});
|
|
563
415
|
|
|
564
|
-
|
|
565
|
-
// Handle audio data from the agent
|
|
566
|
-
playAudio(audio); // Your audio playback implementation
|
|
567
|
-
});
|
|
416
|
+
// other events
|
|
568
417
|
|
|
569
|
-
agent
|
|
570
|
-
|
|
571
|
-
|
|
418
|
+
// Configure the agent once connection is established
|
|
419
|
+
deepgramConnection.configure({
|
|
420
|
+
// agent configuration
|
|
421
|
+
});
|
|
572
422
|
|
|
573
|
-
|
|
574
|
-
console.log("Connection closed");
|
|
423
|
+
// etc...
|
|
575
424
|
});
|
|
576
|
-
|
|
577
|
-
// Send audio data
|
|
578
|
-
function sendAudioData(audioData) {
|
|
579
|
-
agent.send(audioData);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
// Keep the connection alive
|
|
583
|
-
setInterval(() => {
|
|
584
|
-
agent.keepAlive();
|
|
585
|
-
}, 8000);
|
|
586
425
|
```
|
|
587
426
|
|
|
588
|
-
This example demonstrates:
|
|
589
|
-
|
|
590
|
-
- Setting up a WebSocket connection
|
|
591
|
-
- Configuring the agent with speech, language, and audio settings
|
|
592
|
-
- Handling various agent events (speech, transcripts, audio)
|
|
593
|
-
- Sending audio data and keeping the connection alive
|
|
594
|
-
|
|
595
|
-
For a complete implementation, you would need to:
|
|
596
|
-
|
|
597
|
-
1. Add your audio input source (e.g., microphone)
|
|
598
|
-
2. Implement audio playback for the agent's responses
|
|
599
|
-
3. Handle any function calls if your agent uses them
|
|
600
|
-
4. Add proper error handling and connection management
|
|
601
|
-
|
|
602
427
|
[See our API reference for more info](https://developers.deepgram.com/reference/voice-agent-api/agent).
|
|
603
428
|
|
|
604
|
-
|
|
429
|
+
## Text to Speech
|
|
605
430
|
|
|
606
|
-
|
|
431
|
+
### Single-Request
|
|
607
432
|
|
|
608
433
|
Convert text into speech using the REST API.
|
|
609
434
|
|
|
610
435
|
```js
|
|
611
|
-
const { result } = await
|
|
436
|
+
const { result } = await deepgramClient.speak.request(
|
|
437
|
+
{ text },
|
|
438
|
+
{
|
|
439
|
+
model: "aura-2-thalia-en",
|
|
440
|
+
// text to speech options
|
|
441
|
+
}
|
|
442
|
+
);
|
|
612
443
|
```
|
|
613
444
|
|
|
614
445
|
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api/speak).
|
|
615
446
|
|
|
616
|
-
|
|
447
|
+
### Continuous Text Stream (WebSocket)
|
|
617
448
|
|
|
618
|
-
|
|
449
|
+
Connect to our websocket and send a continuous text stream to generate speech.
|
|
619
450
|
|
|
620
451
|
```js
|
|
621
|
-
const
|
|
452
|
+
const deepgramConnection = deepgramClient.speak.live({
|
|
453
|
+
model: "aura-2-thalia-en",
|
|
454
|
+
// live text to speech options
|
|
455
|
+
});
|
|
622
456
|
|
|
623
|
-
|
|
457
|
+
deepgramConnection.on(LiveTTSEvents.Open, () => {
|
|
624
458
|
console.log("Connection opened");
|
|
625
459
|
|
|
626
460
|
// Send text data for TTS synthesis
|
|
627
|
-
|
|
461
|
+
deepgramConnection.sendText(text);
|
|
628
462
|
|
|
629
463
|
// Send Flush message to the server after sending the text
|
|
630
|
-
|
|
464
|
+
deepgramConnection.flush();
|
|
631
465
|
|
|
632
|
-
|
|
466
|
+
deepgramConnection.on(LiveTTSEvents.Close, () => {
|
|
633
467
|
console.log("Connection closed");
|
|
634
468
|
});
|
|
635
469
|
});
|
|
@@ -637,36 +471,26 @@ dgConnection.on(LiveTTSEvents.Open, () => {
|
|
|
637
471
|
|
|
638
472
|
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api/speak-streaming).
|
|
639
473
|
|
|
640
|
-
[See our Example for info](./examples/node-speak-live/index.js).
|
|
641
|
-
|
|
642
474
|
## Text Intelligence
|
|
643
475
|
|
|
644
|
-
Analyze
|
|
476
|
+
Analyze text using our intelligence AI features.
|
|
645
477
|
|
|
646
478
|
```js
|
|
647
479
|
const text = `The history of the phrase 'The quick brown fox jumps over the
|
|
648
480
|
lazy dog'. The earliest known appearance of the phrase was in The Boston
|
|
649
|
-
Journal
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
because it contains every letter of the alphabet: 'A quick brown fox jumps over
|
|
653
|
-
the lazy dog.'" Dozens of other newspapers published the phrase over the
|
|
654
|
-
next few months, all using the version of the sentence starting with "A" rather
|
|
655
|
-
than "The". The earliest known use of the phrase starting with "The" is from
|
|
656
|
-
the 1888 book Illustrative Shorthand by Linda Bronson.[3] The modern form
|
|
657
|
-
(starting with "The") became more common even though it is slightly longer than
|
|
658
|
-
the original (starting with "A").`;
|
|
659
|
-
|
|
660
|
-
const { result, error } = await deepgram.read.analyzeText(
|
|
481
|
+
Journal...`;
|
|
482
|
+
|
|
483
|
+
const { result, error } = await deepgramClient.read.analyzeText(
|
|
661
484
|
{ text },
|
|
662
|
-
{
|
|
485
|
+
{
|
|
486
|
+
language: "en",
|
|
487
|
+
// text intelligence options
|
|
488
|
+
}
|
|
663
489
|
);
|
|
664
490
|
```
|
|
665
491
|
|
|
666
492
|
[See our API reference for more info](https://developers.deepgram.com/reference/text-intelligence-api/text-read).
|
|
667
493
|
|
|
668
|
-
[See our Example for info](./examples/node-read/index.js).
|
|
669
|
-
|
|
670
494
|
## Authentication
|
|
671
495
|
|
|
672
496
|
### Get Token Details
|
|
@@ -674,7 +498,7 @@ const { result, error } = await deepgram.read.analyzeText(
|
|
|
674
498
|
Retrieves the details of the current authentication token.
|
|
675
499
|
|
|
676
500
|
```js
|
|
677
|
-
const { result, error } = await
|
|
501
|
+
const { result, error } = await deepgramClient.manage.getTokenDetails();
|
|
678
502
|
```
|
|
679
503
|
|
|
680
504
|
[See our API reference for more info](https://developers.deepgram.com/reference/authentication)
|
|
@@ -684,8 +508,7 @@ const { result, error } = await deepgram.manage.getTokenDetails();
|
|
|
684
508
|
Creates a temporary token with a 30-second TTL.
|
|
685
509
|
|
|
686
510
|
```js
|
|
687
|
-
const { result, error } = await
|
|
688
|
-
const deepgramWithToken = createClient({ accessToken: result.access_token });
|
|
511
|
+
const { result, error } = await deepgramClient.auth.grantToken();
|
|
689
512
|
```
|
|
690
513
|
|
|
691
514
|
This example shows how to use the temporary token to authenticate a client instance. Note that you _must_ pass an `accessToken` property to use a temporary token. Passing the token as a raw string will error, as the SDK will treat it as an API key and use the incorrect header prefix.
|
|
@@ -699,7 +522,7 @@ This example shows how to use the temporary token to authenticate a client insta
|
|
|
699
522
|
Returns all projects accessible by the API key.
|
|
700
523
|
|
|
701
524
|
```js
|
|
702
|
-
const { result, error } = await
|
|
525
|
+
const { result, error } = await deepgramClient.manage.getProjects();
|
|
703
526
|
```
|
|
704
527
|
|
|
705
528
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-projects).
|
|
@@ -709,7 +532,7 @@ const { result, error } = await deepgram.manage.getProjects();
|
|
|
709
532
|
Retrieves a specific project based on the provided project_id.
|
|
710
533
|
|
|
711
534
|
```js
|
|
712
|
-
const { result, error } = await
|
|
535
|
+
const { result, error } = await deepgramClient.manage.getProject(projectId);
|
|
713
536
|
```
|
|
714
537
|
|
|
715
538
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-project).
|
|
@@ -719,7 +542,7 @@ const { result, error } = await deepgram.manage.getProject(projectId);
|
|
|
719
542
|
Update a project.
|
|
720
543
|
|
|
721
544
|
```js
|
|
722
|
-
const { result, error } = await
|
|
545
|
+
const { result, error } = await deepgramClient.manage.updateProject(projectId, options);
|
|
723
546
|
```
|
|
724
547
|
|
|
725
548
|
[See our API reference for more info](https://developers.deepgram.com/reference/update-project).
|
|
@@ -729,7 +552,7 @@ const { result, error } = await deepgram.manage.updateProject(projectId, options
|
|
|
729
552
|
Delete a project.
|
|
730
553
|
|
|
731
554
|
```js
|
|
732
|
-
const { error } = await
|
|
555
|
+
const { error } = await deepgramClient.manage.deleteProject(projectId);
|
|
733
556
|
```
|
|
734
557
|
|
|
735
558
|
[See our API reference for more info](https://developers.deepgram.com/reference/delete-project).
|
|
@@ -741,7 +564,7 @@ const { error } = await deepgram.manage.deleteProject(projectId);
|
|
|
741
564
|
Retrieves all keys associated with the provided project_id.
|
|
742
565
|
|
|
743
566
|
```js
|
|
744
|
-
const { result, error } = await
|
|
567
|
+
const { result, error } = await deepgramClient.manage.getProjectKeys(projectId);
|
|
745
568
|
```
|
|
746
569
|
|
|
747
570
|
[See our API reference for more info](https://developers.deepgram.com/reference/list-keys).
|
|
@@ -751,7 +574,7 @@ const { result, error } = await deepgram.manage.getProjectKeys(projectId);
|
|
|
751
574
|
Retrieves a specific key associated with the provided project_id.
|
|
752
575
|
|
|
753
576
|
```js
|
|
754
|
-
const { result, error } = await
|
|
577
|
+
const { result, error } = await deepgramClient.manage.getProjectKey(projectId, projectKeyId);
|
|
755
578
|
```
|
|
756
579
|
|
|
757
580
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-key).
|
|
@@ -761,7 +584,7 @@ const { result, error } = await deepgram.manage.getProjectKey(projectId, project
|
|
|
761
584
|
Creates an API key with the provided scopes.
|
|
762
585
|
|
|
763
586
|
```js
|
|
764
|
-
const { result, error } = await
|
|
587
|
+
const { result, error } = await deepgramClient.manage.createProjectKey(projectId, options);
|
|
765
588
|
```
|
|
766
589
|
|
|
767
590
|
[See our API reference for more info](https://developers.deepgram.com/reference/create-key).
|
|
@@ -771,7 +594,7 @@ const { result, error } = await deepgram.manage.createProjectKey(projectId, opti
|
|
|
771
594
|
Deletes a specific key associated with the provided project_id.
|
|
772
595
|
|
|
773
596
|
```js
|
|
774
|
-
const { error } = await
|
|
597
|
+
const { error } = await deepgramClient.manage.deleteProjectKey(projectId, projectKeyId);
|
|
775
598
|
```
|
|
776
599
|
|
|
777
600
|
[See our API reference for more info](https://developers.deepgram.com/reference/delete-key).
|
|
@@ -783,7 +606,7 @@ const { error } = await deepgram.manage.deleteProjectKey(projectId, projectKeyId
|
|
|
783
606
|
Retrieves account objects for all of the accounts in the specified project_id.
|
|
784
607
|
|
|
785
608
|
```js
|
|
786
|
-
const { result, error } = await
|
|
609
|
+
const { result, error } = await deepgramClient.manage.getProjectMembers(projectId);
|
|
787
610
|
```
|
|
788
611
|
|
|
789
612
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-members).
|
|
@@ -793,7 +616,7 @@ const { result, error } = await deepgram.manage.getProjectMembers(projectId);
|
|
|
793
616
|
Removes member account for specified member_id.
|
|
794
617
|
|
|
795
618
|
```js
|
|
796
|
-
const { error } = await
|
|
619
|
+
const { error } = await deepgramClient.manage.removeProjectMember(projectId, projectMemberId);
|
|
797
620
|
```
|
|
798
621
|
|
|
799
622
|
[See our API reference for more info](https://developers.deepgram.com/reference/remove-member).
|
|
@@ -805,7 +628,10 @@ const { error } = await deepgram.manage.removeProjectMember(projectId, projectMe
|
|
|
805
628
|
Retrieves scopes of the specified member in the specified project.
|
|
806
629
|
|
|
807
630
|
```js
|
|
808
|
-
const { result, error } = await
|
|
631
|
+
const { result, error } = await deepgramClient.manage.getProjectMemberScopes(
|
|
632
|
+
projectId,
|
|
633
|
+
projectMemberId
|
|
634
|
+
);
|
|
809
635
|
```
|
|
810
636
|
|
|
811
637
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-member-scopes).
|
|
@@ -815,7 +641,7 @@ const { result, error } = await deepgram.manage.getProjectMemberScopes(projectId
|
|
|
815
641
|
Updates the scope for the specified member in the specified project.
|
|
816
642
|
|
|
817
643
|
```js
|
|
818
|
-
const { result, error } = await
|
|
644
|
+
const { result, error } = await deepgramClient.manage.updateProjectMemberScope(
|
|
819
645
|
projectId,
|
|
820
646
|
projectMemberId,
|
|
821
647
|
options
|
|
@@ -831,7 +657,7 @@ const { result, error } = await deepgram.manage.updateProjectMemberScope(
|
|
|
831
657
|
Retrieves all invitations associated with the provided project_id.
|
|
832
658
|
|
|
833
659
|
```js
|
|
834
|
-
const { result, error } = await
|
|
660
|
+
const { result, error } = await deepgramClient.manage.getProjectInvites(projectId);
|
|
835
661
|
```
|
|
836
662
|
|
|
837
663
|
[See our API reference for more info](https://developers.deepgram.com/reference/list-invites).
|
|
@@ -841,7 +667,7 @@ const { result, error } = await deepgram.manage.getProjectInvites(projectId);
|
|
|
841
667
|
Sends an invitation to the provided email address.
|
|
842
668
|
|
|
843
669
|
```js
|
|
844
|
-
const { result, error } = await
|
|
670
|
+
const { result, error } = await deepgramClient.manage.sendProjectInvite(projectId, options);
|
|
845
671
|
```
|
|
846
672
|
|
|
847
673
|
[See our API reference for more info](https://developers.deepgram.com/reference/send-invites).
|
|
@@ -851,7 +677,7 @@ const { result, error } = await deepgram.manage.sendProjectInvite(projectId, opt
|
|
|
851
677
|
Removes the specified invitation from the project.
|
|
852
678
|
|
|
853
679
|
```js
|
|
854
|
-
const { error } = await
|
|
680
|
+
const { error } = await deepgramClient.manage.deleteProjectInvite(projectId, email);
|
|
855
681
|
```
|
|
856
682
|
|
|
857
683
|
[See our API reference for more info](https://developers.deepgram.com/reference/delete-invite).
|
|
@@ -861,7 +687,7 @@ const { error } = await deepgram.manage.deleteProjectInvite(projectId, email);
|
|
|
861
687
|
Removes the authenticated user from the project.
|
|
862
688
|
|
|
863
689
|
```js
|
|
864
|
-
const { result, error } = await
|
|
690
|
+
const { result, error } = await deepgramClient.manage.leaveProject(projectId);
|
|
865
691
|
```
|
|
866
692
|
|
|
867
693
|
[See our API reference for more info](https://developers.deepgram.com/reference/leave-project).
|
|
@@ -873,7 +699,7 @@ const { result, error } = await deepgram.manage.leaveProject(projectId);
|
|
|
873
699
|
Retrieves all requests associated with the provided project_id based on the provided options.
|
|
874
700
|
|
|
875
701
|
```js
|
|
876
|
-
const { result, error } = await
|
|
702
|
+
const { result, error } = await deepgramClient.manage.getProjectUsageRequests(projectId, options);
|
|
877
703
|
```
|
|
878
704
|
|
|
879
705
|
### Get Request
|
|
@@ -881,7 +707,7 @@ const { result, error } = await deepgram.manage.getProjectUsageRequests(projectI
|
|
|
881
707
|
Retrieves a specific request associated with the provided project_id.
|
|
882
708
|
|
|
883
709
|
```js
|
|
884
|
-
const { result, error } = await
|
|
710
|
+
const { result, error } = await deepgramClient.manage.getProjectUsageRequest(projectId, requestId);
|
|
885
711
|
```
|
|
886
712
|
|
|
887
713
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-request).
|
|
@@ -891,7 +717,7 @@ const { result, error } = await deepgram.manage.getProjectUsageRequest(projectId
|
|
|
891
717
|
Retrieves usage associated with the provided project_id based on the provided options.
|
|
892
718
|
|
|
893
719
|
```js
|
|
894
|
-
const { result, error } = await
|
|
720
|
+
const { result, error } = await deepgramClient.manage.getProjectUsageSummary(projectId, options);
|
|
895
721
|
```
|
|
896
722
|
|
|
897
723
|
[See our API reference for more info](https://developers.deepgram.com/reference/summarize-usage).
|
|
@@ -901,7 +727,7 @@ const { result, error } = await deepgram.manage.getProjectUsageSummary(projectId
|
|
|
901
727
|
Lists the features, models, tags, languages, and processing method used for requests in the specified project.
|
|
902
728
|
|
|
903
729
|
```js
|
|
904
|
-
const { result, error } = await
|
|
730
|
+
const { result, error } = await deepgramClient.manage.getProjectUsageFields(projectId, options);
|
|
905
731
|
```
|
|
906
732
|
|
|
907
733
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-fields).
|
|
@@ -911,7 +737,7 @@ const { result, error } = await deepgram.manage.getProjectUsageFields(projectId,
|
|
|
911
737
|
`Deprecated` Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.
|
|
912
738
|
|
|
913
739
|
```js
|
|
914
|
-
const { result, error } = await
|
|
740
|
+
const { result, error } = await deepgramClient.manage.getProjectUsage(projectId, options);
|
|
915
741
|
```
|
|
916
742
|
|
|
917
743
|
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/usage/get).
|
|
@@ -923,7 +749,7 @@ const { result, error } = await deepgram.manage.getProjectUsage(projectId, optio
|
|
|
923
749
|
Retrieves the list of balance info for the specified project.
|
|
924
750
|
|
|
925
751
|
```js
|
|
926
|
-
const { result, error } = await
|
|
752
|
+
const { result, error } = await deepgramClient.manage.getProjectBalances(projectId);
|
|
927
753
|
```
|
|
928
754
|
|
|
929
755
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-all-balances).
|
|
@@ -933,7 +759,7 @@ const { result, error } = await deepgram.manage.getProjectBalances(projectId);
|
|
|
933
759
|
Retrieves the balance info for the specified project and balance_id.
|
|
934
760
|
|
|
935
761
|
```js
|
|
936
|
-
const { result, error } = await
|
|
762
|
+
const { result, error } = await deepgramClient.manage.getProjectBalance(projectId, balanceId);
|
|
937
763
|
```
|
|
938
764
|
|
|
939
765
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-balance).
|
|
@@ -945,7 +771,7 @@ const { result, error } = await deepgram.manage.getProjectBalance(projectId, bal
|
|
|
945
771
|
Retrieves all models available for a given project.
|
|
946
772
|
|
|
947
773
|
```js
|
|
948
|
-
const { result, error } = await
|
|
774
|
+
const { result, error } = await deepgramClient.manage.getAllModels(projectId, {});
|
|
949
775
|
```
|
|
950
776
|
|
|
951
777
|
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/projects/list-models).
|
|
@@ -955,7 +781,7 @@ const { result, error } = await deepgram.manage.getAllModels(projectId, {});
|
|
|
955
781
|
Retrieves details of a specific model.
|
|
956
782
|
|
|
957
783
|
```js
|
|
958
|
-
const { result, error } = await
|
|
784
|
+
const { result, error } = await deepgramClient.manage.getModel(projectId, modelId);
|
|
959
785
|
```
|
|
960
786
|
|
|
961
787
|
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/models/get)
|
|
@@ -967,7 +793,7 @@ const { result, error } = await deepgram.manage.getModel(projectId, modelId);
|
|
|
967
793
|
Lists sets of distribution credentials for the specified project.
|
|
968
794
|
|
|
969
795
|
```js
|
|
970
|
-
const { result, error } = await
|
|
796
|
+
const { result, error } = await deepgramClient.onprem.listCredentials(projectId);
|
|
971
797
|
```
|
|
972
798
|
|
|
973
799
|
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/list-credentials)
|
|
@@ -977,7 +803,7 @@ const { result, error } = await deepgram.onprem.listCredentials(projectId);
|
|
|
977
803
|
Returns a set of distribution credentials for the specified project.
|
|
978
804
|
|
|
979
805
|
```js
|
|
980
|
-
const { result, error } = await
|
|
806
|
+
const { result, error } = await deepgramClient.onprem.getCredentials(projectId, credentialId);
|
|
981
807
|
```
|
|
982
808
|
|
|
983
809
|
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/get-credentials)
|
|
@@ -987,7 +813,7 @@ const { result, error } = await deepgram.onprem.getCredentials(projectId, creden
|
|
|
987
813
|
Creates a set of distribution credentials for the specified project.
|
|
988
814
|
|
|
989
815
|
```js
|
|
990
|
-
const { result, error } = await
|
|
816
|
+
const { result, error } = await deepgramClient.onprem.createCredentials(projectId, options);
|
|
991
817
|
```
|
|
992
818
|
|
|
993
819
|
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/create-credentials)
|
|
@@ -997,15 +823,13 @@ const { result, error } = await deepgram.onprem.createCredentials(projectId, opt
|
|
|
997
823
|
Deletes a set of distribution credentials for the specified project.
|
|
998
824
|
|
|
999
825
|
```js
|
|
1000
|
-
const { result, error } = await
|
|
826
|
+
const { result, error } = await deepgramClient.onprem.deleteCredentials(projectId, credentialId);
|
|
1001
827
|
```
|
|
1002
828
|
|
|
1003
829
|
[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/delete-credentials)
|
|
1004
830
|
|
|
1005
831
|
## Backwards Compatibility
|
|
1006
832
|
|
|
1007
|
-
We follow semantic versioning (semver) to ensure a smooth upgrade experience. Within a major version (like 4._), we will maintain backward compatibility so your code will continue to work without breaking changes. When we release a new major version (like moving from 3._ to 4.\*), we may introduce breaking changes to improve the SDK. We'll always document these changes clearly in our release notes to help you upgrade smoothly.
|
|
1008
|
-
|
|
1009
833
|
Older SDK versions will receive Priority 1 (P1) bug support only. Security issues, both in our code and dependencies, are promptly addressed. Significant bugs without clear workarounds are also given priority attention.
|
|
1010
834
|
|
|
1011
835
|
## Development and Contributing
|
|
@@ -1018,7 +842,7 @@ To make sure our community is safe for all, be sure to review and agree to our
|
|
|
1018
842
|
|
|
1019
843
|
### Debugging and making changes locally
|
|
1020
844
|
|
|
1021
|
-
If you want to make local changes to the SDK and run the [`examples/`](./examples/), you'll need to `pnpm
|
|
845
|
+
If you want to make local changes to the SDK and run the [`examples/`](./examples/), you'll need to `pnpm build` first, to ensure that your changes are included in the examples that are running.
|
|
1022
846
|
|
|
1023
847
|
## Getting Help
|
|
1024
848
|
|