FastRTC
Turn any Python function into a realtime audio/video stream over WebRTC
About
FastRTC is a Python library from the Gradio team for realtime audio and video communication. You wrap a plain Python function (a generator yielding audio tuples or video frames) in a Stream, and it handles WebRTC signaling, voice activity detection, and turn taking for you. It ships a built-in Gradio UI for instant prototyping (stream.ui.launch()), can be mounted on any FastAPI app to get a WebRTC or WebSocket endpoint for your own frontend (stream.mount(app)), and offers a fastphone() helper to attach a temporary phone number to a stream. Note (verified 2026-10-13): the official site fastrtc.org was unreachable at check time; the GitHub repo remains the canonical home.
What it can do
- Automatic voice activity detection and turn taking (`ReplyOnPause`, `ReplyOnStopWords`)
- Built-in Gradio UI with one call: `.ui.launch()` for prototyping
- WebRTC and WebSocket transports; mount on any FastAPI app via `.mount(app)`
- Audio + video streams (webcam feed to LLMs, e.g. Gemini video chat demos)
- Telephony via `fastphone()` — attaches a temporary phone number to a stream
- Built-in STT/TTS helpers and stop-word detection utilities; cookbook of provider demos (OpenAI realtime, Gemini, Claude)
Setup
pip install fastrtc(add extras for pause detection and TTS:pip install "fastrtc[vad, tts]"— Python 3.10+).- Write a handler: a function/generator taking
(sample_rate, numpy_audio)and yielding a response tuple; wrap it withReplyOnPausefor automatic voice detection and turn taking. - Create the stream:
stream = Stream(ReplyOnPause(echo), modality="audio", mode="send-receive")(or"audio-video"for video). - Prototype:
stream.ui.launch()gives a WebRTC-enabled Gradio UI. Ship: mount it on your FastAPI app withstream.mount(app)for a WebRTC + WebSocket endpoint.
Prerequisites
Python 3.10+, a microphone/browser for the demo UI, API keys for whichever STT/LLM/TTS backends your handler calls (e.g. OpenAI, Gemini); FastAPI for production mounting.
Use cases
Works with
Trust score — 7/10
Scored 7/10 (verified tier, metrics-v1). Evidence: 4,633 GitHub stars (log-scaled vs catalog peers); blended with ~10,899 monthly package downloads; last push 273d ago; 1 releases/12mo; 83 open issues. Manual review: maintenance slowed (last push Jan 2026), not archived; fastphone() free-number claim untested. License: MIT.
★ 4,633 GitHub stars
How the trust score is built
Full methodology →- Adoption · stars/downloads, log-scaled vs peers
- 6.8/10
- Maintenance · recency, releases, issue load
- 4.5/10
- Openness · license + docs
- 10.0/10
- Manual review · sanity read + red-flag check
- 8.0/10
- · 4,633 GitHub stars (log-scaled vs catalog peers)
- · blended with ~10,899 monthly package downloads
- · last push 273d ago; 1 releases/12mo; 83 open issues
- · manual review: maintenance slowed (last push Jan 2026), not archived; fastphone() free-number claim untested
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.