Skip to main content

Overview

SlngSTTService provides real-time speech-to-text transcription over a persistent WebSocket connection to SLNG, a unified voice AI gateway that routes to multiple STT providers (Deepgram, ElevenLabs, Rime, Sarvam, and more) through a single API key. Swap the model string to switch providers; no other code changes needed. The service emits TranscriptionFrame and InterimTranscriptionFrame results.

Source Repository

Source code, examples, and issues for the SLNG integration

PyPI Package

The pipecat-slng package on PyPI

SLNG Website

Learn about the SLNG unified voice AI gateway

SLNG Docs

Documentation for the SLNG platform

Installation

This is a community-maintained package distributed separately from pipecat-ai:
uv add pipecat-slng
# or
pip install pipecat-slng

Prerequisites

SLNG Account Setup

Before using the SLNG STT service, you need:
  1. SLNG Account: Sign up at SLNG
  2. API Key: Get an API key from slng.ai

Required Environment Variables

  • SLNG_API_KEY: Your SLNG API key for authentication

Configuration

api_key
str
required
Authentication key for the SLNG API.
model
str
default:"slng/deepgram/nova:3-en"
The transcription model to use. Use a slng/... prefix for SLNG-hosted routes, or an external route (e.g. deepgram/nova:3) proxied through SLNG.
base_url
str
default:"api.slng.ai"
The API host (without scheme).
encoding
str
default:"linear16"
Audio encoding format. One of "linear16", "mp3", or "opus".
sample_rate
int
default:"None"
Audio sample rate in Hz. If None, uses the pipeline sample rate.
region_override
str
default:"None"
Pin requests to a specific datacenter (e.g. ap-southeast-2, eu-north-1, us-east-1). Sent as the X-Region-Override header.
world_part_override
str
default:"None"
Constrain routing to a broad geographic zone (ap, eu, or na). Sent as the X-World-Part-Override header. If region_override is also set, it wins.
provider_key
str
default:"None"
Your own upstream provider API key (BYOK). Sent as the X-Slng-Provider-Key header so the provider bills your account directly. Only supported on external catalog routes (no slng/ prefix); SLNG-hosted slng/... routes reject it with a 400. See the BYOK docs.
language
Language
default:"Language.EN"
Recognition language. Defaults to Language.EN when not given.
enable_vad
bool
default:"True"
Enable server-side VAD. Defaults to True when not given.
enable_partials
bool
default:"True"
Stream partial (interim) transcripts. Defaults to True when not given.
settings
SlngSTTService.Settings
default:"None"
Runtime-updatable settings override, merged on top of the explicit kwargs above. See Settings below.

Settings

Runtime-configurable settings passed via the settings constructor argument using SlngSTTService.Settings(...). The settings dataclass extends Pipecat’s STTSettings.
ParameterTypeDefaultDescription
modelstr"slng/deepgram/nova:3-en"The transcription model to use.
languageLanguageLanguage.ENLanguage for speech recognition.
enable_vadboolTrueWhether to enable server-side VAD.
enable_partialsboolTrueWhether to receive partial (interim) transcripts.
When the provider surfaces a confidence score, transcripts below 0.5 are dropped. Changing language mid-session reconnects the WebSocket to re-run the init handshake. See the source repository for the authoritative, up-to-date list.

Usage

import os

from pipecat_slng import SlngSTTService

stt = SlngSTTService(
    api_key=os.getenv("SLNG_API_KEY"),
    model="slng/deepgram/nova:3-en",
)

# ... add stt to your pipeline

Compatibility

Tested with Pipecat v1.3.0. Check the source repository for the latest tested version and changelog.