Skip to main content
Version: 1.0.x

Neuphonic TTS

The Neuphonic TTS provider enables your agent to use Neuphonic's high-quality text-to-speech models for generating natural-sounding voice output.

Installation

Install the Neuphonic-enabled VideoSDK Agents package:

pip install "videosdk-plugins-neuphonic"

Importing

from videosdk.agents.plugins import NeuphonicTTS

Authentication

The Neuphonic plugin requires an Neuphonic API key.

Set NEUPHONIC_API_KEY in your .env file.

Example Usage

from videosdk.agents.plugins import NeuphonicTTS
from videosdk.agents import Pipeline

# Initialize the Neuphonic AI TTS model
tts = NeuphonicTTS(
lang_code="en",
voice_id="8e9c4bc8-3979-48ab-8626-df53befc2090",
speed=1.0,
)

# Add tts to pipeline
pipeline = Pipeline(tts=tts)
note

When using .env file for credentials, don't pass them as arguments to model instances or context objects. The SDK automatically reads environment variables, so omit api_key and other credential parameters from your code.

Configuration Options

  • api_key: Your Neuphonic API key (can also be set via NEUPHONIC_API_KEY environment variable)
  • lang_code: Language code for the desired language (e.g., 'en', 'es', 'de', 'nl', 'hi') (default: "en")
  • voice_id: The voice ID for the desired voice (default: None)
  • speed: Playback speed of the audio (range: 0.7-2.0, default: 0.8)
  • sampling_rate: (int) The sampling rate. Must be one of 8000, 16000, 22050 (default: 22050)
  • encoding: (str) Audio encoding. One of "pcm_linear", "pcm_mulaw" (default: "pcm_linear")
  • base_url: (str) The base WebSocket URL (default: "wss://eu-west-1.api.neuphonic.com")
  • max_connection_age_sec: (float) Refresh the WebSocket after this many seconds to avoid hitting idle/session limits (default: 300.0)

Additional Resources

The following resources provide more information about using Neuphonic with VideoSDK Agents SDK.

Got a Question? Ask us on discord