pipedog is an unofficial community port of Pipecat, not affiliated with Daily.
pipedog
Speech-to-text

Gradium

Realtime speech-to-text with GradiumSTTService, over Gradium's WebSocket API, with optional server-side turn detection.

Overview

  • GradiumSTTService: streams audio over a WebSocket to Gradium and pushes interim and final transcriptions. By default the pipeline's VAD closes each utterance by flushing the server. With enableTurnDetection, Gradium's end-pointing signal decides when turns start and end instead.

Installation

bun add @pipedog/gradium
import { GradiumSTTService } from "@pipedog/gradium/stt";

Prerequisites

  • A Gradium account and an API key from Gradium.
  • Pass the key as apiKey. The examples read it from GRADIUM_API_KEY.

GradiumSTTService

Connects to wss://api.gradium.ai/api/speech/asr, with the key in the x-api-key header.

Configuration

Prop

Type

Settings

Runtime-updatable settings, passed as settings: new GradiumSTTService.Settings({...}) (GradiumSTTSettings). The eot* and postFlushCooldownFrames fields tune turn detection and are null unless enableTurnDetection is true, which gives them the defaults below.

SettingTypeDefaultDescription
languageLanguage | "any"Language.ENEnglish, German, Spanish, French or Portuguese; "any" has Gradium detect it.
delayInFramesnumber | null12 (960 ms)Delay, in 80 ms frames, before text is generated. One of 7, 8, 10, 12, 14, 16, 20, 24, 36, 48. Lower is faster.
eotHorizonSnumber | null3.0The end-pointing horizon that drives turn decisions.
eotThresholdnumber | null0.5Inactivity probability at or above which an open turn ends.
postFlushCooldownFramesnumber | null8Step messages to ignore after a flush before the next turn can start or end.

Usage

stt.ts
import { Language } from "@pipedog/core/transcriptions/language";
import { GradiumSTTService } from "@pipedog/gradium/stt";

const stt = new GradiumSTTService({
  apiKey: process.env.GRADIUM_API_KEY ?? "",
  settings: new GradiumSTTService.Settings({ language: Language.EN }),
});

With the server's turn detection:

const withTurns = new GradiumSTTService({
  apiKey: process.env.GRADIUM_API_KEY ?? "",
  enableTurnDetection: true,
  settings: new GradiumSTTService.Settings({ eotHorizonS: 3.0, eotThreshold: 0.5 }),
});

Event handlers

EventDescription
on_connectedThe WebSocket connected.
on_disconnectedThe WebSocket closed.
on_turn_startThe end-pointing signal opened a turn (turn detection on).
on_turn_endThe end-pointing signal closed the turn (turn detection on).

Notes

  • encoding is "pcm" (the sample rate is appended, for example pcm_16000), "wav" or "opus". Audio at a rate Gradium doesn't accept is resampled.
  • With enableTurnDetection, local VAD frames are ignored and the service recommends ExternalUserTurnStrategies, which resolve its ProposedUserStartedSpeakingFrame and ProposedUserStoppedSpeakingFrame into user turns.
RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

Generated from pipecat.runtimes and pipecat.compat in packages/gradium/package.json: ✅ means the compat smoke test passes on that runtime.

Runtime notes

  • The WebSocket goes through the core websocketConnect, with headers on the handshake.
  • The deprecated InputParams, params and json_config options are not ported.
  • Tested against local WebSocket servers, as upstream's tests do, not against Gradium itself.

pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.

Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).

On this page