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

Together AI

Text-to-speech with TogetherTTSService, streaming over Together AI's WebSocket API.

Overview

  • TogetherTTSService: streams text over a WebSocket to Together's speech endpoint and pushes 24 kHz PCM audio as it arrives.

Installation

bun add @pipedog/together
import { TogetherTTSService } from "@pipedog/together/tts";

Prerequisites

  • A Together AI account and an API key from Together AI.
  • Pass the key as apiKey. The examples read it from TOGETHER_API_KEY.

TogetherTTSService

Connects to wss://api.together.ai/v1/audio/speech/websocket.

Configuration

Prop

Type

Settings

Runtime-updatable settings, passed as settings: new TogetherTTSService.Settings({...}) (TogetherTTSSettings). Any setting you leave out keeps the default below.

SettingTypeDefaultDescription
modelstring"hexgrad/Kokoro-82M"Speech model, sent in the URL.
voicestring"af_heart"Voice, sent in the URL.
languageLanguage | nullLanguage.ENLanguage, sent in the URL.
maxPartialLengthnumber | nullnullMaximum partial text length for streaming (max_partial_length).
extraParamsRecord<string, unknown> | nullnullModel-specific options sent in the session update, such as pronunciation_dict.

Usage

tts.ts
import { TTSUpdateSettingsFrame } from "@pipedog/core/frames/frames";
import { TogetherTTSService } from "@pipedog/together/tts";

const tts = new TogetherTTSService({
  apiKey: process.env.TOGETHER_API_KEY ?? "",
  settings: new TogetherTTSService.Settings({ voice: "af_heart" }),
});

Change settings mid-call with an TTSUpdateSettingsFrame:

// Queue it on the worker, or push it from a processor upstream of the service.
const update = new TTSUpdateSettingsFrame({
  delta: new TogetherTTSService.Settings({ voice: "af_bella" }),
});

Event handlers

EventDescription
on_connectedThe WebSocket connected.
on_disconnectedThe WebSocket closed.

Notes

  • Together sends 24 kHz audio. Any other sampleRate logs a warning.
  • An interruption clears the text buffer (input_text_buffer.clear); the end of a turn commits it.
  • Any settings change reconnects, since the session is configured in the connection URL.

Runtime notes

RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

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

  • The WebSocket goes through the core websocketConnect. It works on Bun, Node, Deno and Cloudflare Workers.
  • Tested against a local WebSocket fake, not against Together AI 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