Skip to main content

Overview

Neuphonic provides high-quality text-to-speech synthesis with two service implementations: NeuphonicTTSService (WebSocket-based) with real-time streaming and interruption support, and NeuphonicHttpTTSService (HTTP-based) with server-sent events. NeuphonicTTSService is recommended for interactive applications requiring low latency.

Neuphonic TTS API Reference

Pipecat’s API methods for Neuphonic TTS integration

Example Implementation

Complete example with WebSocket streaming

Neuphonic Documentation

Official Neuphonic TTS API documentation

Voice Library

Browse available voices and features

Installation

To use Neuphonic services, install the required dependencies:

Prerequisites

Neuphonic Account Setup

Before using Neuphonic TTS services, you need:
  1. Neuphonic Account: Sign up at Neuphonic
  2. API Key: Generate an API key from your account dashboard
  3. Voice Selection: Choose from available voice models

Required Environment Variables

  • NEUPHONIC_API_KEY: Your Neuphonic API key for authentication

Configuration

NeuphonicTTSService

str
required
Neuphonic API key for authentication.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=NeuphonicTTSService.Settings(...) instead.
str
default:"wss://api.neuphonic.com"
WebSocket URL for the Neuphonic API.
int
default:"22050"
Output audio sample rate in Hz.
str
default:"pcm_linear"
Audio encoding format.
TextAggregationMode
default:"None"
Controls how incoming text is aggregated before synthesis. SENTENCE (used when None) buffers text until sentence boundaries, producing more natural speech. TOKEN streams tokens directly for lower latency. Import from pipecat.services.tts_service.
bool
default:"None"
deprecated
Deprecated since 0.0.104, removed in 2.0.0. Use text_aggregation_mode instead.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=NeuphonicTTSService.Settings(...) instead.
NeuphonicTTSService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

NeuphonicHttpTTSService

The HTTP service uses SSE (server-sent events) for streaming audio.
str
required
Neuphonic API key for authentication.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=NeuphonicHttpTTSService.Settings(...) instead.
aiohttp.ClientSession
required
An aiohttp session for HTTP requests.
str
default:"https://api.neuphonic.com"
Base URL for the Neuphonic HTTP API.
int
default:"22050"
Output audio sample rate in Hz.
str | None
default:"pcm_linear"
Audio encoding format.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=NeuphonicHttpTTSService.Settings(...) instead.
NeuphonicHttpTTSService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

Settings

Runtime-configurable settings passed via the settings constructor argument using NeuphonicTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.

Usage

Basic Setup (WebSocket)

With Customization (WebSocket)

HTTP Service

Notes

  • WebSocket vs HTTP: The WebSocket service (NeuphonicTTSService) supports interruption handling and keepalive connections, making it better for interactive conversations. The HTTP service (NeuphonicHttpTTSService) uses server-sent events and is simpler to integrate.
  • Keepalive: The WebSocket service automatically sends keepalive messages every 10 seconds to maintain the connection.
  • Settings updates reconnect: NeuphonicTTSService disconnects and reconnects its WebSocket whenever a setting changes.
  • Default sample rate: Both services default to 22050 Hz, which differs from most other TTS services.

Event Handlers

Neuphonic WebSocket TTS supports the standard service connection events: