{"id":13570075,"url":"https://github.com/deepgram/deepgram-js-sdk","last_synced_at":"2025-12-29T01:16:31.813Z","repository":{"id":37910401,"uuid":"363552464","full_name":"deepgram/deepgram-js-sdk","owner":"deepgram","description":"Official JavaScript SDK for Deepgram's automated speech recognition APIs.","archived":false,"fork":false,"pushed_at":"2024-05-20T15:52:54.000Z","size":21787,"stargazers_count":118,"open_issues_count":21,"forks_count":36,"subscribers_count":22,"default_branch":"main","last_synced_at":"2024-05-21T20:13:35.632Z","etag":null,"topics":["ai","asr","automated-speech-recognition","deepgram","hacktoberfest","javascript","speech-recognition","speech-to-text","typescript"],"latest_commit_sha":null,"homepage":"https://developers.deepgram.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepgram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-02T02:47:24.000Z","updated_at":"2024-06-21T15:40:23.312Z","dependencies_parsed_at":"2023-10-27T13:25:47.785Z","dependency_job_id":"a447b805-21cb-4aaa-bd08-da7077db5cb5","html_url":"https://github.com/deepgram/deepgram-js-sdk","commit_stats":{"total_commits":139,"total_committers":20,"mean_commits":6.95,"dds":0.5467625899280575,"last_synced_commit":"7ba3fe846e2097161ed30537c856caab752bfe6a"},"previous_names":["deepgram/deepgram-js-sdk","deepgram/deepgram-node-sdk"],"tags_count":122,"template":false,"template_full_name":"deepgram/oss-repo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-js-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-js-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-js-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-js-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepgram","download_url":"https://codeload.github.com/deepgram/deepgram-js-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","asr","automated-speech-recognition","deepgram","hacktoberfest","javascript","speech-recognition","speech-to-text","typescript"],"created_at":"2024-08-01T14:00:47.976Z","updated_at":"2025-12-29T01:16:31.807Z","avatar_url":"https://github.com/deepgram.png","language":"TypeScript","funding_links":[],"categories":["Specialised APIs"],"sub_categories":[],"readme":"# Deepgram JavaScript SDK\n\n[![Static Badge](https://img.shields.io/badge/%24__-Discord-blue?logo=discord\u0026logoColor=white\u0026link=https%3A%2F%2Fdiscord.gg%2Fdeepgram)](https://discord.gg/deepgram) [![CI](https://github.com/deepgram/node-sdk/actions/workflows/CI.yml/badge.svg)](https://github.com/deepgram/node-sdk/actions/workflows/CI.yml) [![npm (scoped)](https://img.shields.io/npm/v/@deepgram/sdk)](https://www.npmjs.com/package/@deepgram/sdk) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-rounded)](CODE_OF_CONDUCT.md)\n\n\u003e 🎯 **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.\n\n\u003c!-- TOC --\u003e\n\n- [Documentation](#documentation)\n- [Migrating from earlier versions](#migrating-from-earlier-versions)\n  - [V2 to V3](#v2-to-v3)\n  - [V3.\\* to V3.4](#v3-to-v34)\n  - [V3.\\* to V4](#v3-to-v4)\n- [Installation](#installation)\n  - [UMD](#umd)\n  - [ESM](#esm)\n- [Authentication](#authentication)\n  - [1. API Key Authentication (Recommended)](#1-api-key-authentication-recommended)\n  - [2. Access Token Authentication](#2-access-token-authentication)\n  - [3. Proxy Authentication](#3-proxy-authentication)\n  - [Getting Credentials](#getting-credentials)\n    - [API Keys](#api-keys)\n    - [Access Tokens](#access-tokens)\n  - [Environment Variables](#environment-variables)\n  - [Getting an API Key](#getting-an-api-key)\n- [Scoped Configuration](#scoped-configuration)\n  - [Global Defaults](#global-defaults)\n  - [Namespace-specific Configurations](#namespace-specific-configurations)\n  - [Transport Options](#transport-options)\n  - [Examples](#examples)\n    - [Change the API url used for all SDK methods](#change-the-api-url-used-for-all-sdk-methods)\n    - [Change the API url used for the Voice Agent websocket](#change-the-api-url-used-for-the-voice-agent-websocket)\n    - [Change the API url used for transcription only](#change-the-api-url-used-for-transcription-only)\n    - [Override fetch transmitter](#override-fetch-transmitter)\n    - [Proxy requests in the browser](#proxy-requests-in-the-browser)\n    - [Set custom headers for fetch](#set-custom-headers-for-fetch)\n- [Browser Usage](#browser-usage)\n- [Transcription](#transcription)\n  - [Remote Files](#remote-files)\n  - [Local Files](#local-files)\n  - [Callbacks / Async](#callbacks--async)\n  - [Live Transcription (WebSocket)](#live-transcription-websocket)\n  - [Captions](#captions)\n- [Voice Agent](#voice-agent)\n- [Text to Speech](#text-to-speech)\n  - [Single-Request](#single-request)\n  - [Continuous Text Stream (WebSocket)](#continuous-text-stream-websocket)\n- [Text Intelligence](#text-intelligence)\n- [Token Management](#token-management)\n  - [Get Token Details](#get-token-details)\n  - [Grant Access Token](#grant-access-token)\n- [Projects](#projects)\n  - [Get Projects](#get-projects)\n  - [Get Project](#get-project)\n  - [Update Project](#update-project)\n  - [Delete Project](#delete-project)\n- [Keys](#keys)\n  - [List Keys](#list-keys)\n  - [Get Key](#get-key)\n  - [Create Key](#create-key)\n  - [Delete Key](#delete-key)\n- [Members](#members)\n  - [Get Members](#get-members)\n  - [Remove Member](#remove-member)\n- [Scopes](#scopes)\n  - [Get Member Scopes](#get-member-scopes)\n  - [Update Scope](#update-scope)\n- [Invitations](#invitations)\n  - [List Invites](#list-invites)\n  - [Send Invite](#send-invite)\n  - [Delete Invite](#delete-invite)\n  - [Leave Project](#leave-project)\n- [Usage](#usage)\n  - [Get All Requests](#get-all-requests)\n  - [Get Request](#get-request)\n  - [Summarize Usage](#summarize-usage)\n  - [Get Fields](#get-fields)\n  - [Summarize Usage (Deprecated)](#summarize-usage-1)\n- [Billing](#billing)\n  - [Get All Balances](#get-all-balances)\n  - [Get Balance](#get-balance)\n- [Models](#models)\n  - [Get All Models](#get-all-models)\n  - [Get All Project Models](#get-all-project-models)\n  - [Get Model](#get-model)\n- [On-Prem APIs](#on-prem-apis)\n  - [List On-Prem credentials](#list-on-prem-credentials)\n  - [Get On-Prem credentials](#get-on-prem-credentials)\n  - [Create On-Prem credentials](#create-on-prem-credentials)\n  - [Delete On-Prem credentials](#delete-on-prem-credentials)\n- [Backwards Compatibility](#backwards-compatibility)\n- [Development and Contributing](#development-and-contributing)\n  - [Debugging and making changes locally](#debugging-and-making-changes-locally)\n- [Getting Help](#getting-help)\n\u003c!-- /TOC --\u003e\n\n## Documentation\n\nYou can learn more about the Deepgram API at [developers.deepgram.com](https://developers.deepgram.com/docs).\n\n## Migrating from earlier versions\n\n### V2 to V3\n\nWe have published [a migration guide on our docs](https://developers.deepgram.com/docs/js-sdk-v2-to-v3-migration-guide), showing how to move from v2 to v3.\n\n### V3.\\* to V3.4\n\nWe recommend using only documented interfaces, as we strictly follow semantic versioning (semver) and breaking changes may occur for undocumented interfaces. To ensure compatibility, consider pinning your versions if you need to use undocumented interfaces.\n\n### V3.\\* to V4\n\nThe Voice Agent interfaces have been updated to use the new Voice Agent V1 API. Please refer to our [Documentation](https://developers.deepgram.com/docs/voice-agent-v1-migration) on Migration to new V1 Agent API.\n\n## Installation\n\nYou can install this SDK directly from [[npm](https://www.npmjs.com/package/@deepgram/sdk)](https://www.npmjs.com/package/@deepgram/sdk).\n\n```bash\nnpm install @deepgram/sdk\n```\n\nor\n\n```bash\npnpm install @deepgram/sdk\n```\n\nor\n\n```bash\nyarn add @deepgram/sdk\n```\n\n### UMD\n\nYou can now use plain `\u003cscript\u003e`s to import deepgram from CDNs, like:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@deepgram/sdk\"\u003e\u003c/script\u003e\n```\n\nor even:\n\n```html\n\u003cscript src=\"https://unpkg.com/@deepgram/sdk\"\u003e\u003c/script\u003e\n```\n\nThen you can use it from a global deepgram variable:\n\n```html\n\u003cscript\u003e\n  const { createClient } = deepgram;\n  const deepgramClient = createClient(\"deepgram-api-key\");\n\n  console.log(\"Deepgram client instance: \", deepgramClient);\n  // ...\n\u003c/script\u003e\n```\n\n### ESM\n\nYou can now use type=\"module\" `\u003cscript\u003e`s to import deepgram from CDNs, like:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { createClient } from \"https://cdn.jsdelivr.net/npm/@deepgram/sdk/+esm\";\n  const deepgramClient = createClient(\"deepgram-api-key\");\n\n  console.log(\"Deepgram client instance: \", deepgramClient);\n  // ...\n\u003c/script\u003e\n```\n\n## Authentication\n\nThe Deepgram SDK supports three authentication methods:\n\n### 1. API Key Authentication (Recommended)\n\nUses `Token` scheme in Authorization header.\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n\n// Method 1: Pass API key as first parameter\nconst deepgramClient = createClient(\"YOUR_DEEPGRAM_API_KEY\");\n\n// Method 2: Pass API key in options object\nconst deepgramClient = createClient({ key: \"YOUR_DEEPGRAM_API_KEY\" });\n\n// Method 3: Use environment variable (DEEPGRAM_API_KEY)\nconst deepgramClient = createClient();\n```\n\n### 2. Access Token Authentication\n\nUses `Bearer` scheme in Authorization header. Access tokens are temporary (30-second TTL) and must be obtained using an API key.\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n\n// Must use accessToken property in options object\nconst deepgramClient = createClient({ accessToken: \"YOUR_ACCESS_TOKEN\" });\n\n// Or use environment variable (DEEPGRAM_ACCESS_TOKEN)\nconst deepgramClient = createClient();\n```\n\n### 3. Proxy Authentication\n\nFor browser environments or custom proxy setups. Pass `\"proxy\"` as the API key.\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n\nconst deepgramClient = createClient(\"proxy\", {\n  global: { fetch: { options: { proxy: { url: \"http://localhost:8080\" } } } },\n});\n```\n\n\u003e **Important**: Your proxy must set the `Authorization: token DEEPGRAM_API_KEY` header and forward requests to Deepgram's API.\n\n### Getting Credentials\n\n#### API Keys\n\nCreate API keys via the Management API:\n\n```js\nconst { result, error } = await deepgramClient.manage.createProjectKey(projectId, {\n  comment: \"My API key\",\n  scopes: [\"usage:write\"],\n});\n```\n\n**Endpoint**: `POST https://api.deepgram.com/v1/projects/:projectId/keys`\n\n#### Access Tokens\n\nGenerate temporary access tokens (requires existing API key):\n\n```js\nconst { result, error } = await deepgramClient.auth.grantToken();\n// Returns: { access_token: string, expires_in: 30 }\n```\n\n**Endpoint**: `POST https://api.deepgram.com/v1/auth/grant`\n\n### Environment Variables\n\nThe SDK automatically checks for credentials in this priority order:\n\n1. `DEEPGRAM_ACCESS_TOKEN` (highest priority)\n2. `DEEPGRAM_API_KEY` (fallback)\n\n### Getting an API Key\n\n🔑 To access the Deepgram API you will need a [free Deepgram API Key](https://console.deepgram.com/signup?jump=keys).\n\n## Scoped Configuration\n\nThe 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:\n\n### Global Defaults\n\n- The `global` namespace serves as the foundational configuration applicable across all other namespaces unless overridden.\n- Includes general settings like URL and headers applicable for all API calls.\n- If no specific configurations are provided for other namespaces, the `global` defaults are used.\n\n### Namespace-specific Configurations\n\n- Each namespace (`listen`, `manage`, `onprem`, `read`, `speak`) can have its specific configurations which override the `global` settings within their respective scopes.\n- Allows for detailed control over different parts of the application interacting with various Deepgram API endpoints.\n\n### Transport Options\n\n- Configurations for both `fetch` and `websocket` can be specified under each namespace, allowing different transport mechanisms for different operations.\n- For example, the `fetch` configuration can have its own URL and proxy settings distinct from the `websocket`.\n- The generic interfaces define a structure for transport options which include a client (like a `fetch` or `WebSocket` instance) and associated options (like headers, URL, proxy settings).\n\nThis 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.\n\n### Examples\n\n#### Change the API url used for all SDK methods\n\nUseful for using different API environments (for e.g. beta).\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n// - or -\n// const { createClient } = require(\"@deepgram/sdk\");\n\nconst deepgramClient = createClient(DEEPGRAM_API_KEY, {\n  global: { fetch: { options: { url: \"https://api.beta.deepgram.com\" } } },\n});\n```\n\n#### Change the API url used for the Voice Agent websocket\n\nUseful for using a voice agent proxy (for e.g. 3rd party provider auth).\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n// - or -\n// const { createClient } = require(\"@deepgram/sdk\");\n\nconst deepgramClient = createClient(DEEPGRAM_API_KEY, {\n  global: { websocket: { options: { url: \"ws://localhost:8080\" } } },\n});\n```\n\n#### Change the API url used for transcription only\n\nUseful for on-prem installations. Only affects requests to `/listen` endpoints.\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n// - or -\n// const { createClient } = require(\"@deepgram/sdk\");\n\nconst deepgramClient = createClient(DEEPGRAM_API_KEY, {\n  listen: { fetch: { options: { url: \"http://localhost:8080\" } } },\n});\n```\n\n#### Override fetch transmitter\n\nUseful for providing a custom http client.\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n// - or -\n// const { createClient } = require(\"@deepgram/sdk\");\n\nconst yourFetch = async () =\u003e {\n  return Response(\"...etc\");\n};\n\nconst deepgramClient = createClient(DEEPGRAM_API_KEY, {\n  global: { fetch: { client: yourFetch } },\n});\n```\n\n#### Proxy requests in the browser\n\nThis SDK now works in the browser. If you'd like to make REST-based requests (pre-recorded transcription, on-premise, and management requests), then you'll need to use a proxy as we do not support custom CORS origins on our API. To set up your proxy, you configure the SDK like so:\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n\nconst deepgramClient = createClient(\"proxy\", {\n  global: { fetch: { options: { proxy: { url: \"http://localhost:8080\" } } } },\n});\n```\n\n\u003e Important: You must pass `\"proxy\"` as your API key, and use the proxy to set the `Authorization` header to your Deepgram API key.\n\nYour proxy service should replace the Authorization header with `Authorization: token \u003cDEEPGRAM_API_KEY\u003e` and return results verbatim to the SDK.\n\nCheck out our example Node-based proxy here: [Deepgram Node Proxy](https://github.com/deepgram-devs/deepgram-node-proxy).\n\n#### Set custom headers for fetch\n\nUseful for many things.\n\n```js\nimport { createClient } from \"@deepgram/sdk\";\n\nconst deepgramClient = createClient({\n  global: { fetch: { options: { headers: { \"x-custom-header\": \"foo\" } } } },\n});\n```\n\n## Browser Usage\n\nThe SDK works in modern browsers with some considerations:\n\n### WebSocket Features (Full Support)\n\n- **Live Transcription**: ✅ Direct connection to `wss://api.deepgram.com`\n- **Voice Agent**: ✅ Direct connection to `wss://agent.deepgram.com`\n- **Live Text-to-Speech**: ✅ Direct connection to `wss://api.deepgram.com`\n\n### REST API Features (Proxy Required)\n\n- **Pre-recorded Transcription**: ⚠️ Requires proxy due to CORS\n- **Text Intelligence**: ⚠️ Requires proxy due to CORS\n- **Management APIs**: ⚠️ Requires proxy due to CORS\n\n### Setup Options\n\n#### Option 1: CDN (UMD)\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@deepgram/sdk\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const { createClient } = deepgram;\n  const deepgramClient = createClient(\"YOUR_API_KEY\");\n\u003c/script\u003e\n```\n\n#### Option 2: CDN (ESM)\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { createClient } from \"https://cdn.jsdelivr.net/npm/@deepgram/sdk/+esm\";\n  const deepgramClient = createClient(\"YOUR_API_KEY\");\n\u003c/script\u003e\n```\n\n#### Option 3: Proxy for REST APIs\n\nSee [proxy requests in the browser](#proxy-requests-in-the-browser) for REST API access.\n\n## Transcription\n\n### Remote Files\n\nTranscribe audio from a URL.\n\n```js\nconst { result, error } = await deepgramClient.listen.prerecorded.transcribeUrl(\n  { url: \"https://dpgr.am/spacewalk.wav\" },\n  {\n    model: \"nova-3\",\n    // pre-recorded transcription options\n  }\n);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/listen`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).\n\n### Local Files\n\nTranscribe audio from a file.\n\n```js\nconst { result, error } = await deepgramClient.listen.prerecorded.transcribeFile(\n  fs.createReadStream(\"./examples/spacewalk.wav\"),\n  {\n    model: \"nova-3\",\n    // pre-recorded transcription options\n  }\n);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/listen`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).\n\n### Callbacks / Async\n\nWe have a `Callback` version of both `transcribeFile` and `transcribeUrl`, which simply takes a `CallbackUrl` class.\n\n```js\nimport { CallbackUrl } from \"@deepgram/sdk\";\n\nconst { result, error } = await deepgramClient.listen.prerecorded.transcribeUrlCallback(\n  { url: \"https://dpgr.am/spacewalk.wav\" },\n  new CallbackUrl(\"http://callback/endpoint\"),\n  {\n    model: \"nova-3\",\n    // pre-recorded transcription options\n  }\n);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/listen?callback=http://callback/endpoint`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).\n\n### Live Transcription (WebSocket)\n\nConnect to our websocket and transcribe live streaming audio.\n\n```js\nconst deepgramConnection = deepgramClient.listen.live({\n  model: \"nova-3\",\n  // live transcription options\n});\n\ndeepgramConnection.on(LiveTranscriptionEvents.Open, () =\u003e {\n  deepgramConnection.on(LiveTranscriptionEvents.Transcript, (data) =\u003e {\n    console.log(data);\n  });\n\n  source.addListener(\"got-some-audio\", async (event) =\u003e {\n    deepgramConnection.send(event.raw_audio_data);\n  });\n});\n```\n\n**WebSocket Endpoint**: `wss://api.deepgram.com/v1/listen`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen-streaming).\n\n### Captions\n\nConvert deepgram transcriptions to captions.\n\n```js\nimport { webvtt, srt } from \"@deepgram/sdk\";\n\nconst { result, error } = await deepgramClient.listen.prerecorded.transcribeUrl({\n  model: \"nova-3\",\n  // pre-recorded transcription options\n});\n\nconst vttResult = webvtt(result);\nconst srtResult = srt(result);\n```\n\n[See our standalone captions library for more information](https://github.com/deepgram/deepgram-node-captions).\n\n## Voice Agent\n\nConfigure a Voice Agent.\n\n```js\nimport { AgentEvents } from \"@deepgram/sdk\";\n\n// Create an agent connection\nconst deepgramConnection = deepgramClient.agent();\n\n// Set up event handlers\ndeepgramConnection.on(AgentEvents.Open, () =\u003e {\n  console.log(\"Connection opened\");\n\n  // Set up event handlers\n  deepgramConnection.on(AgentEvents.ConversationText, (data) =\u003e {\n    console.log(data);\n  });\n\n  // other events\n\n  // Configure the agent once connection is established\n  deepgramConnection.configure({\n    // agent configuration\n  });\n\n  // etc...\n});\n```\n\n**WebSocket Endpoint**: `wss://agent.deepgram.com/v1/agent/converse`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/voice-agent-api/agent).\n\n## Text to Speech\n\n### Single-Request\n\nConvert text into speech using the REST API.\n\n```js\nconst { result } = await deepgramClient.speak.request(\n  { text },\n  {\n    model: \"aura-2-thalia-en\",\n    // text to speech options\n  }\n);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/speak`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api/speak).\n\n### Continuous Text Stream (WebSocket)\n\nConnect to our websocket and send a continuous text stream to generate speech.\n\n```js\nconst deepgramConnection = deepgramClient.speak.live({\n  model: \"aura-2-thalia-en\",\n  // live text to speech options\n});\n\ndeepgramConnection.on(LiveTTSEvents.Open, () =\u003e {\n  console.log(\"Connection opened\");\n\n  // Send text data for TTS synthesis\n  deepgramConnection.sendText(text);\n\n  // Send Flush message to the server after sending the text\n  deepgramConnection.flush();\n\n  deepgramConnection.on(LiveTTSEvents.Close, () =\u003e {\n    console.log(\"Connection closed\");\n  });\n});\n```\n\n**WebSocket Endpoint**: `wss://api.deepgram.com/v1/speak`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api/speak-streaming).\n\n## Text Intelligence\n\nAnalyze text using our intelligence AI features.\n\n```js\nconst text = `The history of the phrase 'The quick brown fox jumps over the\nlazy dog'. The earliest known appearance of the phrase was in The Boston\nJournal...`;\n\nconst { result, error } = await deepgramClient.read.analyzeText(\n  { text },\n  {\n    language: \"en\",\n    // text intelligence options\n  }\n);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/read`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/text-intelligence-api/text-read).\n\n## Token Management\n\n### Get Token Details\n\nRetrieves the details of the current authentication token.\n\n```js\nconst { result, error } = await deepgramClient.manage.getTokenDetails();\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/auth/token`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/authentication)\n\n### Grant Access Token\n\nCreates a temporary access token with a 30-second TTL. Requires an existing API key for authentication.\n\n```js\n// Create a temporary access token\nconst { result, error } = await deepgramClient.auth.grantToken();\n// Returns: { access_token: string, expires_in: 30 }\n\n// Use the access token in a new client instance\nconst tempClient = createClient({ accessToken: result.access_token });\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/auth/grant`\n\n\u003e **Important**: You _must_ pass an `accessToken` property to use a temporary token. Passing the token as a raw string will treat it as an API key and use the incorrect authorization scheme.\n\n[See our API reference for more info](https://developers.deepgram.com/reference/token-based-auth-api/grant-token).\n\n## Projects\n\n### Get Projects\n\nReturns all projects accessible by the API key.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjects();\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-projects).\n\n### Get Project\n\nRetrieves a specific project based on the provided project_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProject(projectId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-project).\n\n### Update Project\n\nUpdate a project.\n\n```js\nconst { result, error } = await deepgramClient.manage.updateProject(projectId, options);\n```\n\n**API Endpoint**: `PATCH https://api.deepgram.com/v1/projects/:projectId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/update-project).\n\n### Delete Project\n\nDelete a project.\n\n```js\nconst { error } = await deepgramClient.manage.deleteProject(projectId);\n```\n\n**API Endpoint**: `DELETE https://api.deepgram.com/v1/projects/:projectId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/delete-project).\n\n## Keys\n\n### List Keys\n\nRetrieves all keys associated with the provided project_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectKeys(projectId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/keys`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/list-keys).\n\n### Get Key\n\nRetrieves a specific key associated with the provided project_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectKey(projectId, projectKeyId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/keys/:keyId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-key).\n\n### Create Key\n\nCreates an API key with the provided scopes.\n\n```js\nconst { result, error } = await deepgramClient.manage.createProjectKey(projectId, {\n  comment: \"My API key\",\n  scopes: [\"usage:write\"], // Required: array of scope strings\n  tags: [\"production\"], // Optional: array of tag strings\n  time_to_live_in_seconds: 86400, // Optional: TTL in seconds\n  // OR use expiration_date: \"2024-12-31T23:59:59Z\" // Optional: ISO date string\n});\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/projects/:projectId/keys`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/create-key).\n\n### Delete Key\n\nDeletes a specific key associated with the provided project_id.\n\n```js\nconst { error } = await deepgramClient.manage.deleteProjectKey(projectId, projectKeyId);\n```\n\n**API Endpoint**: `DELETE https://api.deepgram.com/v1/projects/:projectId/keys/:keyId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/delete-key).\n\n## Members\n\n### Get Members\n\nRetrieves account objects for all of the accounts in the specified project_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectMembers(projectId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/members`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-members).\n\n### Remove Member\n\nRemoves member account for specified member_id.\n\n```js\nconst { error } = await deepgramClient.manage.removeProjectMember(projectId, projectMemberId);\n```\n\n**API Endpoint**: `DELETE https://api.deepgram.com/v1/projects/:projectId/members/:memberId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/remove-member).\n\n## Scopes\n\n### Get Member Scopes\n\nRetrieves scopes of the specified member in the specified project.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectMemberScopes(\n  projectId,\n  projectMemberId\n);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/members/:memberId/scopes`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-member-scopes).\n\n### Update Scope\n\nUpdates the scope for the specified member in the specified project.\n\n```js\nconst { result, error } = await deepgramClient.manage.updateProjectMemberScope(\n  projectId,\n  projectMemberId,\n  options\n);\n```\n\n**API Endpoint**: `PUT https://api.deepgram.com/v1/projects/:projectId/members/:memberId/scopes`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/update-scope).\n\n## Invitations\n\n### List Invites\n\nRetrieves all invitations associated with the provided project_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectInvites(projectId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/invites`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/list-invites).\n\n### Send Invite\n\nSends an invitation to the provided email address.\n\n```js\nconst { result, error } = await deepgramClient.manage.sendProjectInvite(projectId, options);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/projects/:projectId/invites`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/send-invites).\n\n### Delete Invite\n\nRemoves the specified invitation from the project.\n\n```js\nconst { error } = await deepgramClient.manage.deleteProjectInvite(projectId, email);\n```\n\n**API Endpoint**: `DELETE https://api.deepgram.com/v1/projects/:projectId/invites/:email`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/delete-invite).\n\n### Leave Project\n\nRemoves the authenticated user from the project.\n\n```js\nconst { result, error } = await deepgramClient.manage.leaveProject(projectId);\n```\n\n**API Endpoint**: `DELETE https://api.deepgram.com/v1/projects/:projectId/leave`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/leave-project).\n\n## Usage\n\n### Get All Requests\n\nRetrieves all requests associated with the provided project_id based on the provided options.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectUsageRequests(projectId, options);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/requests`\n\n### Get Request\n\nRetrieves a specific request associated with the provided project_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectUsageRequest(projectId, requestId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/requests/:requestId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-request).\n\n### Summarize Usage\n\nRetrieves usage associated with the provided project_id based on the provided options.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectUsageSummary(projectId, options);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/usage`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/summarize-usage).\n\n### Get Fields\n\nLists the features, models, tags, languages, and processing method used for requests in the specified project.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectUsageFields(projectId, options);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/usage/fields`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-fields).\n\n### Summarize Usage\n\n`Deprecated` Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectUsage(projectId, options);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/usage` (deprecated)\n\n[See our API reference for more info](https://developers.deepgram.com/reference/management-api/usage/get).\n\n## Billing\n\n### Get All Balances\n\nRetrieves the list of balance info for the specified project.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectBalances(projectId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/balances`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-all-balances).\n\n### Get Balance\n\nRetrieves the balance info for the specified project and balance_id.\n\n```js\nconst { result, error } = await deepgramClient.manage.getProjectBalance(projectId, balanceId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/balances/:balanceId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/get-balance).\n\n## Models\n\n### Get All Models\n\nRetrieves all models available globally.\n\n```js\nconst { result, error } = await deepgramClient.models.getAll();\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/models`\n\n### Get All Project Models\n\nRetrieves all models available for a given project.\n\n```js\nconst { result, error } = await deepgramClient.manage.getAllModels(projectId, {});\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/models`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/management-api/projects/list-models).\n\n### Get Model\n\nRetrieves details of a specific model.\n\n```js\nconst { result, error } = await deepgramClient.manage.getModel(projectId, modelId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/models/:modelId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/management-api/models/get)\n\n## On-Prem APIs\n\n### List On-Prem credentials\n\nLists sets of distribution credentials for the specified project.\n\n```js\nconst { result, error } = await deepgramClient.onprem.listCredentials(projectId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/onprem/distribution/credentials`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/list-credentials)\n\n### Get On-Prem credentials\n\nReturns a set of distribution credentials for the specified project.\n\n```js\nconst { result, error } = await deepgramClient.onprem.getCredentials(projectId, credentialId);\n```\n\n**API Endpoint**: `GET https://api.deepgram.com/v1/projects/:projectId/onprem/distribution/credentials/:credentialsId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/get-credentials)\n\n### Create On-Prem credentials\n\nCreates a set of distribution credentials for the specified project.\n\n```js\nconst { result, error } = await deepgramClient.onprem.createCredentials(projectId, options);\n```\n\n**API Endpoint**: `POST https://api.deepgram.com/v1/projects/:projectId/onprem/distribution/credentials`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/create-credentials)\n\n### Delete On-Prem credentials\n\nDeletes a set of distribution credentials for the specified project.\n\n```js\nconst { result, error } = await deepgramClient.onprem.deleteCredentials(projectId, credentialId);\n```\n\n**API Endpoint**: `DELETE https://api.deepgram.com/v1/projects/:projectId/onprem/distribution/credentials/:credentialsId`\n\n[See our API reference for more info](https://developers.deepgram.com/reference/self-hosted-api/delete-credentials)\n\n## Backwards Compatibility\n\nOlder 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.\n\n## Development and Contributing\n\nInterested in contributing? We ❤️ pull requests!\n\nTo make sure our community is safe for all, be sure to review and agree to our\n[Code of Conduct](./CODE_OF_CONDUCT.md). Then see the\n[Contribution](./CONTRIBUTING.md) guidelines for more information.\n\n### Debugging and making changes locally\n\nIf 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.\n\n## Getting Help\n\nWe love to hear from you so if you have questions, comments or find a bug in the\nproject, let us know! You can either:\n\n- [Open an issue in this repository](https://github.com/deepgram/deepgram-node-sdk/issues/new)\n- [Join the Deepgram Discord Community](https://discord.gg/xWRaCDBtW4)\n- [Join the Deepgram Github Discussions Community](https://github.com/orgs/deepgram/discussions)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepgram%2Fdeepgram-js-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepgram%2Fdeepgram-js-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepgram%2Fdeepgram-js-sdk/lists"}