Gradium
Text-to-speech with GradiumTTSService, over Gradium's WebSocket API.
Overview
GradiumTTSService: streams text over a WebSocket to Gradium and pushes 48 kHz audio as it arrives.
Upstream page
Pipecat's documentation for the same service.
Source
packages/gradium/src/tts.ts.
Gradium docs
The text-to-speech WebSocket reference.
Installation
bun add @pipedog/gradiumimport { GradiumTTSService } from "@pipedog/gradium/tts";Prerequisites
- A Gradium account and an API key from Gradium.
- Pass the key as
apiKey. The examples read it fromGRADIUM_API_KEY.
GradiumTTSService
Connects to wss://api.gradium.ai/api/speech/tts, with the key in the x-api-key header.
Configuration
Prop
Type
Settings
Runtime-updatable settings, passed as settings: new GradiumTTSService.Settings({...})
(GradiumTTSSettings). Any setting you leave out keeps the default below.
| Setting | Type | Default | Description |
|---|---|---|---|
model | string | "default" | Speech model. |
voice | string | "_6Aslh2DxfmnRLmP" | Voice id. Changing it reconnects the socket. |
language | Language | null | null | Language. |
Usage
import { GradiumTTSService } from "@pipedog/gradium/tts";
const tts = new GradiumTTSService({
apiKey: process.env.GRADIUM_API_KEY ?? "",
settings: new GradiumTTSService.Settings({ voice: "_6Aslh2DxfmnRLmP" }),
});Notes
- The sample rate is fixed at 48000 Hz.
jsonConfigtakes a JSON string of extra model settings, sent with the setup message.
| Runtime | Works | What it needs |
|---|---|---|
| Bun | ✅ yes | Nothing. |
| Node.js | ✅ yes | Nothing. |
| Deno | ✅ yes | Nothing. |
| Cloudflare Workers | ✅ yes | Nothing. |
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,voice_idandmodelconstructor options are not ported. - Tested against a local WebSocket server (upstream has no Gradium TTS test), 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).