> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slng.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pipecat

> The pipecat-slng Python package connects a Pipecat pipeline to any SLNG speech to text or text to speech model by swapping a single model string.

`pipecat-slng` adds speech to text (STT) and text to speech (TTS) services for
[Pipecat](https://github.com/pipecat-ai/pipecat). It routes your pipeline through
the SLNG gateway, so any streaming model on the platform works behind one API
key. Swap the `model` string to switch provider; no other code changes.

This page is the plugin reference. For a walkthrough that sets up your models in
the dashboard and applies the change, see the
[Pipecat integration guide](/guides/integrate/pipecat).

<Note>
  Tested with Pipecat v1.3.0. [BYOK](#bring-your-own-key-byok) requires
  `pipecat-slng` 0.4.0 or later.
</Note>

## Prerequisites

* Python 3.11+ and `pipecat-ai>=1.3.0`
* A [Pipecat](https://github.com/pipecat-ai/pipecat) project
* An SLNG API key. See [Create your API key](/guides/get-started/quickstart#create-your-api-key).

## Install

```bash theme={null}
uv add pipecat-slng
# or: pip install pipecat-slng
```

## Quickstart

Each service reads your key via `api_key`. Create an STT and a TTS service and add
them to your pipeline:

```python theme={null}
import os

from pipecat_slng import SlngSTTService, SlngTTSService

stt = SlngSTTService(api_key=os.getenv("SLNG_API_KEY"), model="slng/deepgram/nova:3-en")
tts = SlngTTSService(
    api_key=os.getenv("SLNG_API_KEY"),
    model="slng/deepgram/aura:2-en",
    voice="aura-2-thalia-en",
)
```

Both services stream over WebSocket, with low latency and mid-utterance
interruption. Common runtime knobs are top-level keyword arguments (`language`,
`speed`, `enable_vad`, `enable_partials`); for richer overrides, pass
`SlngSTTSettings(...)` or `SlngTTSSettings(...)` to `settings=`.

<Accordion title="Full voice agent example">
  A cascade pipeline (STT → LLM → TTS) using SLNG for speech and OpenAI for the
  language model. The full version, including the Daily transport, lives in
  [`examples/bot.py`](https://github.com/slng-ai/pipecat-slng/blob/main/examples/bot.py).

  ```python bot.py theme={null}
  import os

  from pipecat.audio.vad.silero import SileroVADAnalyzer
  from pipecat.frames.frames import LLMRunFrame
  from pipecat.pipeline.pipeline import Pipeline
  from pipecat.pipeline.runner import PipelineRunner
  from pipecat.pipeline.task import PipelineParams, PipelineTask
  from pipecat.processors.aggregators.llm_context import LLMContext
  from pipecat.processors.aggregators.llm_response_universal import (
      LLMContextAggregatorPair,
      LLMUserAggregatorParams,
  )
  from pipecat.services.openai.responses.llm import OpenAIResponsesLLMService
  from pipecat.transcriptions.language import Language
  from pipecat.transports.base_transport import BaseTransport

  from pipecat_slng import SlngSTTService, SlngTTSService


  async def run_bot(transport: BaseTransport):
      key = os.environ["SLNG_API_KEY"]

      stt = SlngSTTService(
          api_key=key, model="slng/deepgram/nova:3-en", language=Language.EN,
          enable_vad=True, enable_partials=True,
      )
      tts = SlngTTSService(
          api_key=key, model="slng/deepgram/aura:2-en",
          voice="aura-2-arcas-en", language=Language.EN,
      )
      llm = OpenAIResponsesLLMService(api_key=os.getenv("OPENAI_API_KEY"))

      context = LLMContext()
      user_agg, assistant_agg = LLMContextAggregatorPair(
          context,
          user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
      )

      pipeline = Pipeline([
          transport.input(), stt, user_agg, llm, tts, transport.output(), assistant_agg,
      ])
      task = PipelineTask(pipeline, params=PipelineParams(enable_metrics=True))

      @task.rtvi.event_handler("on_client_ready")
      async def on_client_ready(rtvi):
          context.add_message({"role": "user", "content": "Please introduce yourself."})
          await task.queue_frames([LLMRunFrame()])

      await PipelineRunner(handle_sigint=False).run(task)
  ```
</Accordion>

## Model identifiers

Models follow `provider/model:variant`, with a `-lang` suffix where the model
exposes per-language variants. Prefix with `slng/` for an SLNG-hosted instance; a
bare identifier is the external passthrough route, required for
[BYOK](#bring-your-own-key-byok).

```python theme={null}
model="slng/deepgram/nova:3-en"      # SLNG-hosted (STT)
model="deepgram/nova:3"              # external passthrough (STT)
```

The full list is the [model catalog](/models/catalog/all-models). Not every model
accepts every option (for example `speed` on TTS); check the
[Unified TTS reference](/api-reference/unified-api/slng/unmute-tts-bridge/unmute-tts-bridge-http) before tuning.

## STT reference

`SlngSTTService` streams speech to text over WebSocket, connecting to
`wss://api.slng.ai/v1/bridges/unmute/stt/{model}`. Transcripts below `0.5`
confidence are dropped before reaching your pipeline. `Language` is imported from
`pipecat.transcriptions.language`.

| Parameter         | Default                     | Description                                                                                      |
| ----------------- | --------------------------- | ------------------------------------------------------------------------------------------------ |
| `api_key`         | required                    | SLNG API key.                                                                                    |
| `model`           | `"slng/deepgram/nova:3-en"` | Model identifier.                                                                                |
| `base_url`        | `"api.slng.ai"`             | Gateway host. Point at a regional host to pin execution (see [Region routing](#region-routing)). |
| `encoding`        | `"linear16"`                | `"linear16"`, `"mp3"`, or `"opus"`.                                                              |
| `sample_rate`     | pipeline rate               | Audio sample rate in Hz.                                                                         |
| `language`        | `Language.EN`               | Recognition language.                                                                            |
| `enable_vad`      | `True`                      | Server-side VAD.                                                                                 |
| `enable_partials` | `True`                      | Stream interim transcripts.                                                                      |
| `provider_key`    | `None`                      | Your own provider key ([BYOK](#bring-your-own-key-byok), external routes only).                  |
| `settings`        | `None`                      | `SlngSTTSettings` for runtime updates.                                                           |

## TTS reference

`SlngTTSService` streams text to speech over WebSocket, connecting to
`wss://api.slng.ai/v1/bridges/unmute/tts/{model}`. This is the recommended path
for interactive agents. Changing `voice`, `speed`, or `language` mid-session
reconnects the WebSocket to re-run the init handshake. Pick a voice from the
[text to speech catalog](/models/catalog/text-to-speech).

| Parameter      | Default                     | Description                                                                                      |
| -------------- | --------------------------- | ------------------------------------------------------------------------------------------------ |
| `api_key`      | required                    | SLNG API key.                                                                                    |
| `model`        | `"slng/deepgram/aura:2-en"` | Model identifier.                                                                                |
| `voice`        | `None`                      | Voice identifier (server default if unset).                                                      |
| `base_url`     | `"api.slng.ai"`             | Gateway host. Point at a regional host to pin execution (see [Region routing](#region-routing)). |
| `encoding`     | `"linear16"`                | `"linear16"`, `"mp3"`, `"opus"`, `"mulaw"`, or `"alaw"`.                                         |
| `sample_rate`  | pipeline rate               | Audio sample rate in Hz.                                                                         |
| `language`     | `Language.EN`               | Synthesis language.                                                                              |
| `speed`        | `None`                      | Speech speed multiplier (server default if unset).                                               |
| `provider_key` | `None`                      | Your own provider key ([BYOK](#bring-your-own-key-byok), external routes only).                  |
| `settings`     | `None`                      | `SlngTTSSettings` for runtime updates.                                                           |

<Tip>
  Prefer the streaming `SlngTTSService` for conversational agents. For batch or
  non-interactive synthesis, `SlngHttpTTSService` issues one HTTP `POST` per
  utterance. Its body accepts only `{text, voice}`, so encoding, sample rate,
  language, and speed are not configurable over HTTP; compressed responses yield
  an `ErrorFrame`.
</Tip>

## Region routing

Route to a sovereign hub by pointing `base_url` at a regional gateway host, for
example `eu.api.slng.ai` or `us.api.slng.ai`. Data stays in-jurisdiction and every
hub runs the full stack. See the [regions map](/guides/regions/regions-map) for
the available hosts.

```python theme={null}
stt = SlngSTTService(
    api_key=os.getenv("SLNG_API_KEY"),
    model="slng/deepgram/nova:3-en",
    base_url="eu.api.slng.ai",
)
```

## Bring your own key (BYOK)

Pass `provider_key` to bill an upstream provider directly on your own contract;
all three services forward it as the `X-Slng-Provider-Key` header, and the SLNG
cache still applies on top. See [Bring your own key](/guides/models/bring-your-own-key).

```python theme={null}
stt = SlngSTTService(
    api_key=os.getenv("SLNG_API_KEY"),
    model="deepgram/nova:3",            # external route, no slng/ prefix
    provider_key=os.getenv("SLNG_PROVIDER_KEY"),
)
```

<Note>
  BYOK works on external routes only (no `slng/` prefix). SLNG-hosted routes
  reject the header with an HTTP 400. Since 0.4.0, WebSocket connect-rejection
  errors include the server's response body, so a misrouted request reports the
  reason.
</Note>

## Next steps

* [Pipecat integration guide](/guides/integrate/pipecat) for the migration
  walkthrough.
* The [model catalog](/models/catalog/all-models) and
  [Unified API guide](/guides/models/unified-api).
* Using LiveKit instead? See the [LiveKit plugin](/integrations/plugins/livekit).
