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

# PyAI Hear Speech-to-Text

> PyAISTTService streams audio to PyAI Hear for STT and returns interim and final transcripts in a Pipecat pipeline.

> [!NOTE]
>
> **Community-maintained integration.** This service is built and
> maintained by
> [atomsai (PyAI)](https://github.com/atomsai)
> . Pipecat does not test or officially support it. Please report issues and
> request changes on the
> [source repository](https://github.com/atomsai/pyai-speech-integrations)
> . Learn more about
> [community integrations](https://docs.pipecat.ai/api-reference/server/services/community-integrations.md)
> .

## Overview

`PyAISTTService` provides streaming speech recognition through PyAI Hear in a Pipecat pipeline.

> [card] [Source and examples](https://github.com/atomsai/pyai-speech-integrations/tree/main/pipecat-pyai)
>
> PyAI-maintained source, Apache-2.0 license, and examples.

> [card] [PyAI integration guide](https://docs.pyai.com/guides/pipecat)
>
> Framework setup and provider configuration.

## Installation

```bash theme={null}
uv add pipecat-pyai==0.1.5
```

Python 3.11 or newer is required. The package declares Pipecat `>=1.3.0,<2.0`.
A two-turn audio flow was exercised with Pipecat 1.8.1; this is not qualification
of every version in that range. Version 0.1.4's STT startup-settings correction
was checked separately from that earlier audio run. Version 0.1.5 adds the
standalone WebRTC example, public source/documentation links, and TTS session
cleanup. Its package and framework compatibility checks generate no audio.

## Prerequisites

Create a PyAI account and a server-side key with the `hear:stream` scope.
Before running audio, verify the selected project, billing environment, and
limits with `GET https://api.pyai.com/v1/me`. Usage is charged or limited according
to that key; Pipecat hosting, transport, and LLM costs are separate.

### Required Environment Variables

* `PYAI_API_KEY`: the server-side PyAI key. Keep it out of browser code and source control.

## Configuration

```python theme={null}
from pipecat_pyai import PyAISTTService
```

### PyAISTTService

**api\_key** `str | None`

Default: `None`. Server-side PyAI key. When omitted, reads `PYAI_API_KEY`.
Raises `ValueError` if neither is supplied.

**base\_url** `str` (default: [https://api.pyai.com](https://api.pyai.com))

PyAI API base URL.

**model** `str` (default: pyai-hear)

PyAI model identifier.

**sample\_rate** `int | None`

Default: `None`. Audio sample rate in Hz. When omitted, uses the pipeline
audio rate.

**language** `str`

Default: empty string (`""`). An empty string enables automatic detection. See
[supported languages](https://docs.pyai.com/reference/language-support) for
explicit codes.

Additional keyword arguments are forwarded to Pipecat's base service.

### Settings

Configure provider options in the constructor. The adapter initializes Pipecat
settings metadata, but does not implement runtime provider-setting updates.
Create a new service to change model or language; do not pass a second `settings=` argument.

## Usage

The following function builds the input part of a pipeline from existing components.
See the [complete WebRTC demo](https://github.com/atomsai/pyai-speech-integrations/blob/main/demos/pipecat_bot.py)
for transport, VAD, LLM, worker, and disconnect handling.

```python theme={null}
from pipecat.pipeline.pipeline import Pipeline
from pipecat_pyai import PyAISTTService


def speech_input(transport, user_aggregator, llm):
    return Pipeline([transport.input(), PyAISTTService(), user_aggregator, llm])
```

## Frames

Interim results use `InterimTranscriptionFrame`; corrected final text uses `TranscriptionFrame`. Configure a VAD in the user aggregator to finalize spoken turns.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.