Wraps Python handlers as live audio and video streams over WebRTC or WebSockets, with Gradio UI and FastAPI mounting helpers.
Overview
FastRTC is a Python library that turns functions into real-time audio and video communication streams. It targets voice agents, transcription, and multimodal apps by handling WebRTC or WebSocket transport while your code focuses on per-chunk logic.
Built-in pause detection supports turn-taking conversational flows, and optional voice-activity and text-to-speech extras install separately. You can launch a Gradio UI with stream.launch(), mount endpoints on FastAPI via mount() for custom frontends, or use fastphone() to obtain a temporary inbound phone number for audio-only trials when authenticated with Hugging Face.
Examples in the cookbook cover Gemini and OpenAI realtime voice, Whisper transcription, YOLO object detection on webcam frames, Kyutai Moshi speech-to-speech, and stop-word triggered coding assistants. Documentation walks through echo audio, LLM voice chat, webcam streaming, and running under Gradio, telephone audio, or FastAPI deployment patterns.
The library sits in the Gradio ecosystem and integrates with common AI and speech APIs showcased in demos, while leaving model and provider choices to the application author.
Key features
- WebRTC and WebSocket streaming
- Built-in voice pause detection
- Gradio UI launch helper
- FastAPI mount for custom clients
- Temporary phone number via fastphone
- Optional VAD and TTS extras
- Cookbook voice and vision examples
- Realtime handler abstraction in Python
Use cases
- Voice chatbots with automatic turn taking
- Browser webcam inference pipelines
- Phone-accessible audio demos
- FastAPI backends with live media
- Streaming speech recognition prototypes