feat(voice): add Deepgram voice provider

JI
20d ago
+377-54

What

Adds a Deepgram voice provider to @voltagent/voice, alongside the existing OpenAI, ElevenLabs, and xsai providers.

  • Text-to-speech (speak) via Deepgram Aura models
  • Speech-to-text (listen) via Deepgram Nova models
  • getVoices returning the Aura voice catalog
  • API key via the apiKey option or the DEEPGRAM_API_KEY environment variable

It implements BaseVoiceProvider and follows the conventions of the existing providers (event emission, error wrapping, options shape), and is exported from the package entry point.

Real-time streaming (connect/send) currently throws as not-yet-supported, matching the OpenAI provider — it can be added as a follow-up.

Usage

import { createReadStream } from "node:fs";
import { DeepgramVoiceProvider } from "@voltagent/voice";

const voice = new DeepgramVoiceProvider({ apiKey: process.env.DEEPGRAM_API_KEY });

const audio = await voice.speak("Hello from VoltAgent", { voice: "aura-asteria-en" });
const transcript = await voice.listen(createReadStream("audio.wav"));

Tests

Added unit tests covering construction, API-key resolution (option + DEEPGRAM_API_KEY fallback), the voice catalog, empty-input handling, and the unsupported realtime methods.

Verification

  • pnpm --filter @voltagent/voice build — clean (JS + ESM + type declarations)
  • pnpm --filter @voltagent/voice test — 6 passing
  • pnpm --filter @voltagent/voice lint — clean
  • Added a changeset (@voltagent/voice, minor)

Summary by cubic

Adds a Deepgram voice provider to @voltagent/voice with Aura text-to-speech (speak), Nova speech-to-text (listen), and the Aura voice catalog (getVoices).

New Features

  • DeepgramVoiceProvider implements BaseVoiceProvider, is exported from the package entry point, and accepts an API key via the apiKey option or the DEEPGRAM_API_KEY environment variable.
  • ttsModel/voice accept known Aura voices with autocomplete while allowing arbitrary model strings.
  • Realtime connect() and send() throw as not-yet-supported, matching the OpenAI provider.
  • Adds @deepgram/sdk as a dependency and a minor changeset for @voltagent/voice.

Summary by CodeRabbit

  • New Features
    • Added a Deepgram voice provider for generating speech from text and transcribing prerecorded audio.
    • Choose from supported Aura voices and configure speech and transcription models, audio encoding, sample rate, and language.
    • Supply an API key directly or through the DEEPGRAM_API_KEY environment variable.
  • Limitations
    • Real-time voice connections and audio sending are not supported by this provider.