|
| 1 | +# FunASR + Dify Integration Guide |
| 2 | + |
| 3 | +Use FunASR as a local speech-to-text backend for [Dify](https://github.com/langgenius/dify) via the OpenAI-compatible API. |
| 4 | + |
| 5 | +## Why FunASR with Dify? |
| 6 | + |
| 7 | +- **Privacy**: All audio stays local, no cloud API calls |
| 8 | +- **Speed**: 170x realtime (vs ~1x for cloud APIs) |
| 9 | +- **Free**: No per-minute charges, no API keys needed |
| 10 | +- **Features**: Speaker diarization, emotion detection, 50+ languages |
| 11 | + |
| 12 | +## Setup |
| 13 | + |
| 14 | +### 1. Start FunASR Server |
| 15 | + |
| 16 | +```bash |
| 17 | +pip install torch torchaudio |
| 18 | +pip install funasr vllm fastapi uvicorn python-multipart |
| 19 | +funasr-server --device cuda --port 8000 |
| 20 | +``` |
| 21 | + |
| 22 | +### 2. Configure in Dify |
| 23 | + |
| 24 | +In Dify Settings -> Model Provider: |
| 25 | + |
| 26 | +1. Select **OpenAI-API-Compatible** provider |
| 27 | +2. Set: |
| 28 | + - **API Base URL**: `http://your-server:8000/v1` |
| 29 | + - **API Key**: `unused` (any value works) |
| 30 | + - **Model Name**: `fun-asr-nano` |
| 31 | + |
| 32 | +### 3. Enable Speech-to-Text |
| 33 | + |
| 34 | +In your Dify app settings: |
| 35 | +1. Go to Features -> Speech to Text |
| 36 | +2. Enable it |
| 37 | +3. Select the OpenAI-compatible provider you configured |
| 38 | + |
| 39 | +## Supported Models |
| 40 | + |
| 41 | +| Model Name | Best For | Speed | |
| 42 | +|-----------|----------|-------| |
| 43 | +| `fun-asr-nano` | 31 languages + Chinese dialects | 340x realtime (vLLM) | |
| 44 | +| `sensevoice` | Ultra-fast, 5 languages | 170x realtime | |
| 45 | +| `paraformer` | Chinese (classic, stable) | 120x realtime | |
| 46 | + |
| 47 | +## Links |
| 48 | + |
| 49 | +- [FunASR GitHub](https://github.com/modelscope/FunASR) |
| 50 | +- [Dify GitHub](https://github.com/langgenius/dify) |
| 51 | +- [FunASR Website](https://www.funasr.com) |
0 commit comments