Skip to content

Weimw/deepgram-node-sdk

 
 

Repository files navigation

Deepgram Node.js SDK

CI npm (scoped) Contributor Covenant

Official Node.js SDK for Deepgram. Power your apps with world-class speech and Language AI models.

This SDK only supports hosted usage of api.deepgram.com.

Deprecated JS Browser SDK

As of version 2.x, the JS Browser SDK was removed from the Node SDK and will become an independent Client SDK. To use the older SDK, please npm i @deepgram/sdk@1.2.1 and use @deepgram/sdk/browser.

Getting an API Key

🔑 To access the Deepgram API you will need a free Deepgram API Key.

Installation

npm install @deepgram/sdk
# - or -
# yarn add @deepgram/sdk

Constructor

const { Deepgram } = require("@deepgram/sdk");
// - or -
// import { Deepgram } from "@deepgram/sdk";

const deepgram = new Deepgram(DEEPGRAM_API_KEY);

Transcription

Remote Files

const response = await deepgram.transcription.preRecorded(
  { url: URL_OF_FILE },
  options
);

See our API reference for more info.

Local Files

const response = await deepgram.transcription.preRecorded(
  {
    stream: fs.createReadStream("/path/to/file"),
    mimetype: MIMETYPE_OF_FILE,
  },
  options
);

See our API reference for more info.

Live Audio

const ws = dg.transcription.live(options);

// source.addListener('got-some-audio', async (event) => {
ws.send(event);
// })

See an example, here: https://github.com/deepgram-devs/node-live-example.

See our API reference for more info.

Projects

Get Projects

Returns all projects accessible by the API key.

const result = await deepgram.projects.list();

See our API reference for more info.

Get Project

Retrieves a specific project based on the provided project_id.

const result = await deepgram.projects.get(project_id);

See our API reference for more info.

Update Project

Update a project.

const result = await deepgram.projects.update(project_id, options);

See our API reference for more info.

Delete Project

Delete a project.

await deepgram.projects.delete(project_id);

See our API reference for more info.

Keys

List Keys

Retrieves all keys associated with the provided project_id.

const result = await deepgram.keys.list(project_id);

See our API reference for more info.

Get Key

Retrieves a specific key associated with the provided project_id.

const result = await deepgram.keys.get(project_id, key_id);

See our API reference for more info.

Create Key

Creates an API key with the provided scopes.

let scopes = ["member", "etc"];
const result = await deepgram.keys.create(project_id, comment, scopes, options);

See our API reference for more info.

Delete Key

Deletes a specific key associated with the provided project_id.

await deepgram.keys.delete(project_id, key_id);

See our API reference for more info.

Members

Get Members

Retrieves account objects for all of the accounts in the specified project_id.

const result = await deepgram.members.listMembers(project_id);

See our API reference for more info.

Remove Member

Removes member account for specified member_id.

const result = await deepgram.members.removeMember(project_id, member_id);

See our API reference for more info.

Scopes

Get Member Scopes

Retrieves scopes of the specified member in the specified project.

const result = await deepgram.scopes.get(project_id, member_id);

See our API reference for more info.

Update Scope

Updates the scope for the specified member in the specified project.

let scope = "member:read";
const result = await deepgram.scopes.update(project_id, member_id, scope);

See our API reference for more info.

Invitations

List Invites

Retrieves all invitations associated with the provided project_id.

const result = await deepgram.invitations.list(project_id);

See our API reference for more info.

Send Invite

Sends an invitation to the provided email address.

const result = await deepgram.invitation.send(project_id, options);

See our API reference for more info.

Delete Invite

Removes the specified invitation from the project.

let email = "devrel@deepgram.com";
const result = await deepgram.invitation.delete(project_id, email);

See our API reference for more info.

Leave Project

Removes the authenticated user from the project.

const result = await deepgram.invitation.leave(project_id);

See our API reference for more info.

Usage

Get All Requests

Retrieves all requests associated with the provided project_id based on the provided options.

const result = await deepgram.usage.listRequests(project_id, options);

See our API reference for more info.

Get Request

Retrieves a specific request associated with the provided project_id.

const result = await deepgram.usage.getRequest(project_id, request_id);

See our API reference for more info.

Summarize Usage

Retrieves usage associated with the provided project_id based on the provided options.

const result = await deepgram.usage.getUsage(project_id, options);

See our API reference for more info.

Get Fields

Lists the features, models, tags, languages, and processing method used for requests in the specified project.

const result = await deepgram.usage.getFields(project_id, options);

See our API reference for more info.

Billing

Get All Balances

Retrieves the list of balance info for the specified project.

const result = await deepgram.billing.listBalances(project_id);

See our API reference for more info.

Get Balance

Retrieves the balance info for the specified project and balance_id.

const result = await deepgram.billing.getBalance(project_id, balance_id);

See our API reference for more info.

Development and Contributing

Interested in contributing? We ❤️ pull requests!

To make sure our community is safe for all, be sure to review and agree to our Code of Conduct. Then see the Contribution guidelines for more information.

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

About

Official JavaScript SDK for Deepgram's automated speech recognition APIs.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.7%
  • Dockerfile 1.7%
  • Other 0.6%