npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@deepdub/node

v1.2.3

Published

Deepdub API SDK

Readme

Deepdub SDK

This is the official SDK for the Deepdub API. It provides a simple way to interact with the API and generate dubbing scripts for your videos.

Install

npm install --save @deepdub/node

# or

yarn add @deepdub/node

Usage

const { DeepdubClient } = require('@deepdub/node');

require('dotenv').config();

async function main() {
  const deepdub = new DeepdubClient('YOUR_API_KEY');
  const voicePromptId = 'YOUR_PROMPT_ID';
  await deepdub.connect();

  // You can generate into a buffer:
  //
  const buffer = await deepdub.generateToBuffer('Hello, this is a test.', {
    locale: 'en-US',
    voicePromptId,
  });

  // Or you can generate into a file:
  //
  await deepdub.generateToFile('./generated.wav', 'Hello, this is a test.', {
    locale: 'en-US',
    voicePromptId,
  });
}

main();

Client Initialization

By default, the DeepdubClient uses WebSocket protocol for streaming audio generation. You can also use HTTP protocol by passing the protocol option:

// Default: WebSocket protocol (supports streaming)
const deepdub = new DeepdubClient('YOUR_API_KEY');

// HTTP protocol (supports additional options like sampleRate and voiceReference)
const deepdub = new DeepdubClient('YOUR_API_KEY', { protocol: 'http' });

Protocol Comparison

| Feature | WebSocket | HTTP | | ---------------------------- | --------------- | ---- | | Streaming chunks (onChunk) | ✅ | ❌ | | sampleRate option | ⚠️ mp3 only | ✅ | | voiceReference option | ❌ | ✅ |

Use WebSocket (default) when you need real-time streaming. Use HTTP when you need voiceReference or sampleRate with non-mp3 formats.

Streaming Chunks

You can receive audio chunks as they arrive using the onChunk callback. This is useful for streaming audio playback or processing audio in real-time.

const buffer = await deepdub.generateToBuffer('Hello, this is a test.', {
  locale: 'en-US',
  voicePromptId: promptId,
  onChunk: (chunk) => {
    // Each chunk is a Buffer containing WAV audio data
    console.log(`Received ${chunk.length} bytes`);
  },
});

Headerless Chunks

By default, each chunk includes a WAV header. If you need raw audio data without headers (e.g., for streaming to an audio player), use the headerless option:

const buffer = await deepdub.generateToBuffer('Hello, this is a test.', {
  locale: 'en-US',
  voicePromptId: promptId,
  headerless: true,
  onChunk: (chunk) => {
    // Each chunk is raw PCM audio data (no WAV header)
    audioPlayer.write(chunk);
  },
});

The onChunk and headerless options are also available with generateToFile.