dify - 💡(How to fix) Fix [Feature] FunASR integration: self-hosted STT with OpenAI-compatible API

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

# Start FunASR with OpenAI-compatible endpoint
pip install funasr fastapi uvicorn python-multipart
python examples/openai_api/server.py --device cuda --port 8000

---

from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="x")
result = client.audio.transcriptions.create(model="sensevoice", file=open("a.wav","rb"))
RAW_BUFFERClick to expand / collapse

Motivation

Dify supports OpenAI for speech-to-text, but many users need a self-hosted, privacy-friendly alternative. FunASR (16K+ stars) now provides an OpenAI-compatible API server that works as a drop-in replacement.

How it works

# Start FunASR with OpenAI-compatible endpoint
pip install funasr fastapi uvicorn python-multipart
python examples/openai_api/server.py --device cuda --port 8000

Then in Dify, configure STT to point to http://localhost:8000/v1 — same API format as OpenAI.

Why?

  • 170x realtime on GPU (vs Whisper 13x)
  • Self-hosted — audio never leaves your network
  • 50+ languages with auto-detection
  • Speaker diarization built-in
  • MIT licensed, no API costs
  • CPU-friendly — 17x realtime without GPU

Tested

Verified end-to-end with OpenAI Python SDK:

from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="x")
result = client.audio.transcriptions.create(model="sensevoice", file=open("a.wav","rb"))

Repo: https://github.com/modelscope/FunASR/tree/main/examples/openai_api

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

dify - 💡(How to fix) Fix [Feature] FunASR integration: self-hosted STT with OpenAI-compatible API