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

# Smallest AI Speech-to-Text

> SmallestSTTService provides real-time streaming STT through Smallest AI's Pulse and Pulse 2.0 models over the Waves WebSocket API.

## Overview

Smallest AI provides real-time speech-to-text transcription through a WebSocket-based integration with their Waves API. The service connects to `wss://api.smallest.ai/waves/v1/stt/live?model=pulse` to stream audio continuously and receive interim and final transcription results with low latency.

> [card] [Smallest AI STT API Reference](https://reference-server.pipecat.ai/en/latest/api/pipecat.services.smallest.stt.html)
>
> Complete API reference for all parameters and methods

> [card] [Example Implementation](https://github.com/pipecat-ai/pipecat/blob/main/examples/voice/voice-smallest.py)
>
> Complete example with WebSocket streaming

## Installation

```bash theme={null}
uv add "pipecat-ai[smallest]"
```

## Prerequisites

1. **Smallest AI Account**: Sign up at [Smallest AI](https://www.smallest.ai/)
2. **API Key**: Generate an API key from your account dashboard

Set the following environment variable:

```bash theme={null}
export SMALLEST_API_KEY=your_api_key
```

## Configuration

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

Smallest AI API key for authentication.

**base\_url** `str` (default: wss\://api.smallest.ai)

Base WebSocket URL for the Smallest API. Override for custom or proxied
deployments.

**encoding** `str` (default: linear16)

Audio encoding format.

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

Audio sample rate in Hz. When `None`, uses the pipeline's configured sample
rate.

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

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

**ttfs\_p99\_latency** `float | None` (default: SMALLEST\_TTFS\_P99)

P99 latency from speech end to final transcript in seconds. Used for
processing metrics.

### Settings

Runtime-configurable settings passed via the `settings` constructor argument using `SmallestSTTService.Settings(...)`. These can be updated mid-conversation with `STTUpdateSettingsFrame`. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `pulse` | Model identifier: `pulse` or `pulse-2` (English-only). Using `pulse-2` with a non-English `language` raises a `ValueError`. |
| `language` | `Language \| str` | `Language.EN` | Language code for transcription. |
| `word_timestamps` | `bool` | `False` | Include word-level timestamps in transcription results. |
| `full_transcript` | `bool` | `False` | Include cumulative transcript in results. |
| `sentence_timestamps` | `bool` | `False` | Include sentence-level timestamps in transcription results. |
| `redact_pii` | `bool` | `False` | Redact personally identifiable information from transcripts. |
| `redact_pci` | `bool` | `False` | Redact payment card information from transcripts. |
| `numerals` | `str` | `auto` | Convert spoken numerals to digits. Options: `auto`, `always`, or `none`. |
| `diarize` | `bool` | `False` | Enable speaker diarization to identify different speakers. |
| `endpointing` | `bool` | `True` | Finalize transcripts promptly on trailing silence. No effect on `pulse-2`. |
| `keywords` | `str` | `""` | Comma-separated `KEYWORD:INTENSIFIER` pairs to boost recognition of domain-specific words/phrases (e.g. `"Blackwell:2"`). |
| `format` | `bool` | `True` | Apply punctuation and capitalization to transcripts. |
| `emotion_detection` | `bool` | `True` | `pulse-2` only. Adds a six-class per-utterance `emotion` object to every final transcript. No effect on `pulse`. |
| `gender_detection` | `bool` | `True` | `pulse-2` only. Adds an acoustic per-utterance `gender` estimate to every final transcript. No effect on `pulse`. |
| `itn_normalize` | `bool` | `False` | Run inverse text normalization so spoken numbers come back as digits (e.g. "twenty five" becomes "25"). |
| `no_format_delay` | `bool` | `False` | With `itn_normalize` on, emit every final as soon as it is ready instead of holding back a number still being dictated to merge it into the next final. No effect unless `itn_normalize` is `True`. |

## Usage

### Basic Setup

```python theme={null}
import os

from pipecat.services.smallest.stt import SmallestSTTService
from pipecat.transcriptions.language import Language

stt = SmallestSTTService(
    api_key=os.getenv("SMALLEST_API_KEY"),
    settings=SmallestSTTService.Settings(
        language=Language.EN,
    ),
)
```

### With Advanced Features

```python theme={null}
stt = SmallestSTTService(
    api_key=os.getenv("SMALLEST_API_KEY"),
    settings=SmallestSTTService.Settings(
        language=Language.ES,
        word_timestamps=True,
        diarize=True,
        redact_pii=True,
    ),
)
```

### With Pulse 2.0

```python theme={null}
stt = SmallestSTTService(
    api_key=os.getenv("SMALLEST_API_KEY"),
    settings=SmallestSTTService.Settings(
        model="pulse-2",
        emotion_detection=True,
        gender_detection=True,
    ),
)
```

### Updating Settings at Runtime

Transcription settings can be changed mid-conversation using `STTUpdateSettingsFrame`:

```python theme={null}
from pipecat.frames.frames import STTUpdateSettingsFrame
from pipecat.services.smallest.stt import SmallestSTTSettings

await worker.queue_frame(
    STTUpdateSettingsFrame(
        delta=SmallestSTTSettings(
            language=Language.FR,
            word_timestamps=False,
        )
    )
)
```

> [!TIP]
>
> Changing settings will trigger a WebSocket reconnection, which may cause a
> brief interruption in transcription.

## Notes

* **WebSocket streaming**: The service uses WebSocket connections for real-time streaming. The connection is automatically managed and will reconnect if interrupted.
* **VAD integration**: Uses Pipecat's VAD to detect when the user stops speaking and sends a `finalize` message to flush the final transcript while keeping the session alive for the next utterance.
* **Pulse 2.0**: `pulse-2` is English-only and has built-in end-of-turn detection, but Pipecat's VAD and user turn strategies still decide when the user's turn ends, and the VAD-triggered `finalize` flushes the final transcript as with `pulse`. With `emotion_detection` and `gender_detection` enabled, final transcripts include per-utterance `emotion` and `gender` in the `TranscriptionFrame` `result`; both are omitted for very short utterances.
* **Keepalive**: When no audio has been sent for 10 seconds, the service sends silent audio to prevent idle timeouts on the WebSocket connection.
* **Response format**: The service receives transcription responses containing `transcript` (the recognized text), `is_final` (whether this is a final vs. interim result), `language` (detected or specified language), and `session_id` (unique identifier for the WebSocket session).
* **Language support**: See the supported languages in Smallest AI's [Pulse model card](https://docs.smallest.ai/waves/model-cards/speech-to-text/pulse).

## Event Handlers

Smallest AI STT supports the standard [service connection events](https://docs.pipecat.ai/api-reference/server/events/service-events.md):

| Event | Description |
| - | - |
| `on_connected` | Connected to Smallest AI WebSocket |
| `on_disconnected` | Disconnected from Smallest WebSocket |
| `on_connection_error` | WebSocket connection error occurred |

```python theme={null}
@stt.event_handler("on_connected")
async def on_connected(service):
    print("Connected to Smallest AI STT")
```


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