From 679f40c1a73bebe8c68bf85d19f17779ed701e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=B8=E9=9B=81?= Date: Thu, 28 May 2026 23:08:26 +0800 Subject: [PATCH] examples: add Dify integration guide (connect via OpenAI-compatible API) --- examples/dify/README.md | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 examples/dify/README.md diff --git a/examples/dify/README.md b/examples/dify/README.md new file mode 100644 index 000000000..197b6883a --- /dev/null +++ b/examples/dify/README.md @@ -0,0 +1,51 @@ +# FunASR + Dify Integration Guide + +Use FunASR as a local speech-to-text backend for [Dify](https://github.com/langgenius/dify) via the OpenAI-compatible API. + +## Why FunASR with Dify? + +- **Privacy**: All audio stays local, no cloud API calls +- **Speed**: 170x realtime (vs ~1x for cloud APIs) +- **Free**: No per-minute charges, no API keys needed +- **Features**: Speaker diarization, emotion detection, 50+ languages + +## Setup + +### 1. Start FunASR Server + +```bash +pip install torch torchaudio +pip install funasr vllm fastapi uvicorn python-multipart +funasr-server --device cuda --port 8000 +``` + +### 2. Configure in Dify + +In Dify Settings -> Model Provider: + +1. Select **OpenAI-API-Compatible** provider +2. Set: + - **API Base URL**: `http://your-server:8000/v1` + - **API Key**: `unused` (any value works) + - **Model Name**: `fun-asr-nano` + +### 3. Enable Speech-to-Text + +In your Dify app settings: +1. Go to Features -> Speech to Text +2. Enable it +3. Select the OpenAI-compatible provider you configured + +## Supported Models + +| Model Name | Best For | Speed | +|-----------|----------|-------| +| `fun-asr-nano` | 31 languages + Chinese dialects | 340x realtime (vLLM) | +| `sensevoice` | Ultra-fast, 5 languages | 170x realtime | +| `paraformer` | Chinese (classic, stable) | 120x realtime | + +## Links + +- [FunASR GitHub](https://github.com/modelscope/FunASR) +- [Dify GitHub](https://github.com/langgenius/dify) +- [FunASR Website](https://www.funasr.com)