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

# FunASR Speech-to-Text

> Offline STT with FunASRSTTService running SenseVoice models locally on CPU or GPU: multilingual, with strong Chinese support.

## Overview

`FunASRSTTService` provides offline speech recognition using FunASR's SenseVoice models running locally on CPU or GPU. SenseVoice is a multilingual model with strong Chinese accuracy, supporting Chinese, Cantonese, English, Japanese, Korean, and other languages. The non-autoregressive architecture enables fast inference, making it a strong fully-local STT option for voice agents. No API key needed - models download once on first use and are cached locally for privacy-focused transcription.

> [card] [FunASR STT API Reference](https://reference-server.pipecat.ai/en/latest/api/pipecat.services.funasr.stt.html)
>
> Pipecat's API methods for FunASR STT integration

> [card] [FunASR Example](https://github.com/pipecat-ai/pipecat/blob/main/examples/voice/voice-funasr.py)
>
> Complete example with FunASR STT

> [card] [FunASR Documentation](https://github.com/modelscope/FunASR)
>
> FunASR model details and research

> [card] [SenseVoice Model](https://github.com/FunAudioLLM/SenseVoice)
>
> SenseVoice multilingual ASR model

## Installation

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

## Prerequisites

### Local Model Setup

Before using FunASR STT service, you need:

1. **Model Selection**: Choose an appropriate FunASR model (default: `iic/SenseVoiceSmall`)
2. **Storage Space**: Ensure sufficient disk space for model downloads (models are cached after first use)
3. **CPU or GPU Resources**: FunASR can run on CPU or GPU (CUDA)

### Configuration Options

* **Model Selection**: Default is `iic/SenseVoiceSmall`, but other FunASR models are supported
* **Language Support**: SenseVoice natively supports Chinese (`zh`), Cantonese (`yue`), English (`en`), Japanese (`ja`), and Korean (`ko`) with automatic language detection for other languages
* **Device Selection**: Choose `"cpu"` or `"cuda"` based on your hardware
* **No API Key**: Runs entirely locally for complete privacy

> [!TIP]
>
> No API keys required - FunASR runs entirely locally for complete privacy. Can
> run on CPU or GPU.

## Configuration

**device** `str` (default: "cpu")

Inference device. Use `"cpu"` or `"cuda"` for GPU acceleration.

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

Runtime-configurable settings for the STT service. See
[FunASRSTTSettings](#funasrsttsettings) below.

## FunASRSTTSettings

Runtime-configurable settings passed via the `settings` constructor argument using `FunASRSTTService.Settings(...)`. These can be updated mid-conversation with `STTUpdateSettingsFrame`, except `model`, which isn't applied at runtime: the service keeps the model it loaded at construction. See [Service Settings](https://docs.pipecat.ai/pipecat/fundamentals/service-settings.md) for details.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `model` | `str` | `"iic/SenseVoiceSmall"` | FunASR model identifier. Default is SenseVoiceSmall. *(Inherited from base STT settings.)* |
| `language` | `Language \| str` | `Language.EN` | Language for transcription. Natively supports Chinese (`zh`), Cantonese (`yue`), English (`en`), Japanese (`ja`), and Korean (`ko`). Falls back to auto-detection for other languages and for `None`. *(Inherited from base STT settings.)* |
| `use_itn` | `bool` | `True` | Apply inverse text normalization (e.g., converts spoken numbers like "nine" to numerals "9"). |

## Usage

### Basic Setup

```python theme={null}
from pipecat.services.funasr.stt import FunASRSTTService

stt = FunASRSTTService()
```

### With GPU Acceleration

```python theme={null}
from pipecat.services.funasr.stt import FunASRSTTService

stt = FunASRSTTService(device="cuda")
```

### With Custom Language

```python theme={null}
from pipecat.services.funasr.stt import FunASRSTTService
from pipecat.transcriptions.language import Language

stt = FunASRSTTService(
    settings=FunASRSTTService.Settings(
        language=Language.ZH,  # Chinese
    ),
)
```

### With Inverse Text Normalization Disabled

```python theme={null}
from pipecat.services.funasr.stt import FunASRSTTService

stt = FunASRSTTService(
    settings=FunASRSTTService.Settings(
        use_itn=False,
    ),
)
```

### With Custom Model

```python theme={null}
from pipecat.services.funasr.stt import FunASRSTTService

stt = FunASRSTTService(
    settings=FunASRSTTService.Settings(
        model="iic/SenseVoiceSmall",  # or another FunASR model identifier
    ),
)
```

## Notes

* **First run downloads**: The selected model downloads from the ModelScope hub on first use and is cached locally. Later runs load it from the cache.
* **Segmented transcription**: `FunASRSTTService` extends `SegmentedSTTService`, meaning it processes complete audio segments after VAD detects the user has stopped speaking.
* **CPU and GPU support**: FunASR can run on CPU or GPU (CUDA). Use the `device` parameter to choose.
* **Audio format**: Expects 16-bit mono PCM audio at 16 kHz sample rate. The service doesn't resample, so keep the pipeline's input sample rate (`PipelineParams.audio_in_sample_rate`) at its default of 16000.
* **Multilingual support**: SenseVoice natively supports Chinese, Cantonese, English, Japanese, and Korean. For other languages, it falls back to automatic language detection.
* **No external dependencies**: Unlike API-based STT services, FunASR requires no API keys or network connectivity after the initial model download.
* **Inverse text normalization**: By default, `use_itn=True` converts spoken numbers to numerals (e.g., "nine" → "9"). Disable this with `use_itn=False` if you need the raw transcription.
* **Non-autoregressive inference**: SenseVoice uses non-autoregressive architecture for fast inference, making it suitable for real-time voice agents.


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