> ## 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.

# AirCaps AI Speech-to-Text

> Real-time English STT with AirCapsLiveSTTService and AirCaps Live 1, with finals on VAD stop or model-detected end of turn.

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

## Overview

`AirCapsLiveSTTService` provides real-time English speech-to-text through
AirCaps Live 1 (`aircaps-live-1`), a low-latency model from
[AirCaps AI](https://aircaps.ai) built for voice agents. It extends Pipecat's `WebsocketSTTService`, so connection
management, reconnection, keepalive and metrics follow the same patterns as the
built-in services. Interim results are pushed as `InterimTranscriptionFrame` and
finals as `TranscriptionFrame`.

By default Pipecat decides when a turn ends: when a `VADUserStoppedSpeakingFrame`
arrives, the service sends `finalize`, and the turn's final transcript comes back
right away, pushed with `finalized=True`. With `end_of_turn=True`, the model
decides instead (see [Model-detected end of turn](#model-detected-end-of-turn)).

> [card] [Source Repository](https://github.com/aircaps/pipecat-aircaps)
>
> Source code, README, changelog and issues

> [card] [Example](https://github.com/aircaps/pipecat-aircaps/blob/main/examples/voice-agent.py)
>
> A voice agent that hears the user through AirCaps Live 1

> [card] [AirCaps Live 1 Guide](https://aircaps.ai/docs/guides/live-1)
>
> The model, its streaming protocol and end-of-turn settings

> [card] [PyPI Package](https://pypi.org/project/pipecat-aircaps/)
>
> The `pipecat-aircaps` package on PyPI

## Installation

This is a community-maintained package distributed separately from `pipecat-ai`:

```bash theme={null}
uv add pipecat-aircaps
```

## Prerequisites

### AirCaps AI Account Setup

Before using the AirCaps AI STT service, you need:

1. **AirCaps AI Account**: Sign up at [console.aircaps.ai](https://console.aircaps.ai)
2. **API Key**: Open **API keys** in the console and create one

### Required Environment Variables

* `AIRCAPS_API_KEY`: Your AirCaps AI API key, passed to the service as `api_key`

## Configuration

**api\_key** `str` *required*

AirCaps AI API key.

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

AirCaps AI API address. Before each connection the service asks it which
WebSocket to open.

**sample\_rate** `int` (default: None)

Sample rate of the incoming audio in Hz. If `None`, uses the pipeline's input
sample rate. Audio is resampled to 16 kHz before it is sent.

**end\_of\_turn** `bool` (default: False)

Let the model detect the end of each turn instead of Pipecat's VAD and turn
strategies. See [Model-detected end of turn](#model-detected-end-of-turn).

**should\_interrupt** `bool` (default: True)

With `end_of_turn=True`: whether a new user turn interrupts the bot.

**settings** `AirCapsLiveSTTService.Settings` (default: None)

Runtime-updatable settings. See [Settings](#settings) below.

**ttfs\_p99\_latency** `float` (default: 0.25)

P99 latency from speech end to final transcript, in seconds, used by turn
strategies. Measure your own deployment with
[stt-benchmark](https://github.com/pipecat-ai/stt-benchmark) and pass the
result.

### Settings

Runtime-configurable settings passed via the `settings` constructor argument
using `AirCapsLiveSTTService.Settings(...)`. They can be updated mid-conversation
with `STTUpdateSettingsFrame`; the session reopens to apply them. The end-of-turn
settings apply only with `end_of_turn=True`; the last four override single values
of `end_of_turn_mode`, and `None` keeps the mode's value.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `"aircaps-live-1"` | Model id. |
| `language` | `Language` | `Language.EN` | English only. |
| `end_of_turn_mode` | `str` | `"balanced"` | `"min_latency"`, `"balanced"` or `"max_accuracy"`: speed versus certainty. |
| `end_of_turn_threshold` | `float \| None` | `None` | How sure the model must be that the turn ended, 0.2 to 0.9. |
| `min_turn_silence_ms` | `int \| None` | `None` | The shortest pause that can end a turn, 0 to 1000 ms. |
| `max_turn_silence_ms` | `int \| None` | `None` | A pause this long always ends the turn, 500 to 5000 ms, or 0 for no limit. |
| `vad_threshold` | `float \| None` | `None` | How sure the model's voice detector must be that it hears speech, 0.3 to 0.9. |

## Usage

### Basic Setup

The service needs VAD frames to know when a turn ends, which the user aggregator
provides when it has a VAD analyzer:

```python theme={null}
import os

from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.pipeline.pipeline import Pipeline
from pipecat.processors.aggregators.llm_response_universal import (
    LLMContextAggregatorPair,
    LLMUserAggregatorParams,
)
from pipecat_aircaps import AirCapsLiveSTTService

stt = AirCapsLiveSTTService(api_key=os.getenv("AIRCAPS_API_KEY"))

user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
    context,
    user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
)

pipeline = Pipeline(
    [
        transport.input(),
        stt,
        user_aggregator,
        llm,
        tts,
        transport.output(),
        assistant_aggregator,
    ]
)
```

### Model-detected end of turn

With `end_of_turn=True`, the model decides when the user has finished. The
service pushes `ProposedUserStartedSpeakingFrame` when a turn's first words
arrive, and the turn's final `TranscriptionFrame` followed by
`ProposedUserStoppedSpeakingFrame` when the model ends the turn. It recommends
`ExternalUserTurnStrategies`, so the user aggregator follows these frames; your
own `user_turn_strategies` take precedence if you pass them.

```python theme={null}
from pipecat_aircaps import AirCapsLiveSTTService

stt = AirCapsLiveSTTService(
    api_key=os.getenv("AIRCAPS_API_KEY"),
    end_of_turn=True,
    settings=AirCapsLiveSTTService.Settings(end_of_turn_mode="balanced"),
)
```

## Notes

* **Audio format**: The service sends 16-bit mono PCM at 16 kHz.
* **Connections**: Before each session the service looks up which WebSocket to
  open (`GET /v1/realtime/endpoint`). A session the server ends is reopened
  automatically.
* **Idle connections**: While no audio flows (for example, while the user is
  muted), the service pings the session so it stays open.
* **Concurrency**: Accounts run one AirCaps Live 1 session at a time by default;
  [contact AirCaps AI](https://aircaps.ai/contact) for more.
* **Language**: English only.

## Compatibility

Tested with Pipecat 1.16.0 and Python 3.11, 3.12 and 3.13. See the [source
repository](https://github.com/aircaps/pipecat-aircaps) for the latest tested
version and changelog.


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