AbsoluteJS

@absolutejs/voice-playht

@absolutejs/voice-playhtv0.0.1-beta.6betaVoice & Media

PlayHT text-to-speech adapter for @absolutejs/voice

#Installation

BASH
bun add @absolutejs/voice-playht

#Capabilities

Overview

PlayHT text-to-speech adapter for @absolutejs/voice.

Wraps PlayHT's /api/v2/tts/stream HTTP endpoint behind the TTSAdapter seam so the voice runtime can stream Play3.0-mini / PlayDialog / PlayHT2.0-turbo audio out as soon as the first byte arrives.

Use

For telephony at 8 kHz μ-law:

Options

Option — Required — Default — Notes

apiKey — yes — — — PlayHT API key, sent as Authorization: Bearer .

userId — yes — — — PlayHT user id, sent as X-USER-ID.

Show 7 more

voice — yes — — — Voice id string (s3://...json for stock voices, or your own cloned voice id).

voiceEngine — no — Play3.0-mini — Play3.0-mini / PlayDialog / PlayHT2.0-turbo / PlayHT2.0.

outputFormat — no — raw — Must be raw (PCM s16le) or mulaw (telephony @ 8 kHz). mp3/wav are rejected because they aren't streamable frame-by-frame.

sampleRate — no — 24_000 — Ignored for mulaw (PlayHT forces 8 kHz).

language, quality, speed, temperature, voiceGuidance — no — — — Forwarded as-is to PlayHT.

baseUrl — no — https://api.play.ht — Override for staging / enterprise hosts.

fetch — no — globalThis.fetch — Inject for tests; opportunistic HTTP/2 multiplexing is enabled for HTTPS targets.

Notes

session.close(reason) aborts in-flight requests and refuses further send() calls.

Whitespace-only send() is a no-op (matches the Cartesia / ElevenLabs / Azure adapters).

This adapter does not currently use PlayHT's WebSocket streaming endpoint; for low TTFB, the HTTP streaming endpoint is good enough. Open an issue if you need WebSocket.

Outcomes

What you can build

Build on the supported package contract

Use @absolutejs/voice-playht through its supported public entry points.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/voice-playht version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/voice-playht example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Use

Partial snippet

Working example for Use.

TS
import { voice } from "@absolutejs/voice";
import { playht } from "@absolutejs/voice-playht";

const app = voice({
  // ... stt + other voice options ...
  tts: playht({
    apiKey: process.env.PLAYHT_API_KEY!,
    userId: process.env.PLAYHT_USER_ID!,
    voice: "s3://voice-cloning-zero-shot/.../jennifer.json",
    // optional:
    voiceEngine: "Play3.0-mini", // default
    outputFormat: "raw", // default
    sampleRate: 24_000, // default
    language: "english",
    quality: "premium",
    speed: 1.0,
    temperature: 1.0,
    voiceGuidance: 1.5,
  }),
});

#Use 2

Partial snippet

For telephony at 8 kHz μ-law:

TS
playht({
  apiKey,
  userId,
  voice,
  outputFormat: "mulaw", // PlayHT serves μ-law @ 8 kHz
});

#Public entry points

Supported entry points declared by this package manifest.

Package entry point declared in package.json.

@absolutejs/voice-playht@absolutejs/voice-playht/manifest@absolutejs/voice-playht/manifest.json

#Package commands

Scripts declared by this package manifest.

bun run buildrm -rf dist && bun build ./src/index.ts ./src/manifest.ts --outdir dist --target bun --external @absolutejs/manifest --external '@absolutejs/manifest/*' --external @absolutejs/voice --external '@absolutejs/voice/*' --external @sinclair/typebox --external '@sinclair/typebox/*' && tsc --emitDeclarationOnly --project tsconfig.json && absolute-manifest emit
bun run check:packagebun run format && bun run typecheck && bun run test && bun run verify-package && bun run build && bun run verify-package --artifacts
bun run formatprettier --write "./**/*.{js,ts,json,md}"
bun run testbun test
bun run typecheckbun run tsc --noEmit

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

6 symbols
playhtexportPermalinkSource
TS
playht
Exported from @absolutejs/voice-playht