# Repository Briefing: gradio-app/fastrtc
> Source: https://repoforai.com/repo/gradio-app/fastrtc (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/gradio-app/fastrtc
- **Official Docs / Website**: https://fastrtc.org/
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: JavaScript
- **License**: MIT
- **Engineering Health**: A (76/100 · Maintenance 26/35 · Adoption 19/25 · Releases 11/20 · License 20/20)
- **Latest Release**: 0.0.34 (2025-11-24) — https://github.com/gradio-app/fastrtc/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Self-Hosted
- **Momentum**: 4,642 ★ total (+0 24h / +1 7d) · 441 forks
- **Topics**: `artificial-intelligence`, `hacktoberfest`, `hacktoberfest2025`, `llm`, `python`, `real-time`, `speech-to-text`, `text-to-speech`
- **When to Use**: Best for: Python teams that want to validate a voice agent, browser transcription, or live webcam inference in Gradio, then integrate the same media handler into a FastAPI service. Skip if: You need a managed communications service, production telephony rather than a temporary test number, or direct control over the lower-level media stack.

## Overview
```text
### Architecture & Core Mechanics
FastRTC is a Python media framework, with the application boundary at `Stream(handler=..., modality=..., mode=...)`. In the bidirectional examples, webcam frames go to a Python callback that returns processed frames, while an audio handler can yield chunks as `(sample_rate, ndarray)` tuples. `ReplyOnPause` wraps the audio reply handler to invoke it on a detected pause, separating turn detection from application logic.

The repository separates `backend/` and `frontend/`, with `demo/`, `docs/`, and `test/` alongside them. The Python manifest includes aiortc and aioice for WebRTC and ICE, Gradio for the built-in UI, and NumPy, librosa, and Numba in the runtime dependency set. The same `Stream` abstraction supports either a built-in UI via `.ui.launch()` or FastAPI-mounted WebRTC and WebSocket endpoints via `.mount(app)`. Model calls and application-specific processing live in the handler rather than the transport configuration.

### Key Capabilities & Differentiators
The practical range runs from echo audio and NumPy webcam transforms to real-time Whisper transcription and YOLOv10 detection on browser webcam frames. The webcam detection example passes a Gradio slider value into the frame handler as a confidence threshold, illustrating how UI parameters can affect processing without changing the media transport.

For voice, one example composes Groq-hosted Whisper transcription, Claude 3.5 Haiku, and ElevenLabs streaming TTS, turning `pcm_24000` output into 24 kHz 16-bit NumPy chunks. That example streams synthesized audio back but waits for transcription and the text reply before synthesis. Other demos illustrate Gemini audio/video chat, Gemini and OpenAI real-time voice APIs, and Kyutai Moshi. These are integration examples, not evidence that their models or client SDKs ship with the base package. For audio-only testing by phone, `.fastphone()` can obtain a temporary number with a Hugging Face token.

### Trade-offs & Limitations
Compared with integrating aiortc and FastAPI directly, FastRTC saves work where media callbacks, pause-triggered replies, and a test UI match the application. The abstraction is less compelling when a team already owns its media stack or needs tighter control of session behavior. Compared with a managed real-time communications platform, the self-hosted path gives the team control of the Python service but leaves it responsible for connectivity, authentication, and capacity planning. Test WebRTC across the actual client networks, including whether they need a relay.

Inference placement is a separate decision. Hosted APIs avoid running those models locally but introduce network dependencies, provider limits and costs, and external data handling. Local inference avoids that dependency only if the entire model path is local, and sizing then depends on model choice and concurrency. For a chained voice application, measure end-of-turn to first returned audio, not just transport latency: pause detection, transcription, text generation, and synthesis can each contribute.

### Hardware & Deployment Guide
Install `fastrtc` on Python 3.10 or newer, or install `fastrtc[vad, tts]` for built-in pause detection and TTS. Gradio is constrained to >=4.0,<6.0. On Python 3.13 and later the manifest conditionally adds `audioop-lts`, `standard-aifc`, and `standard-sunau`. Use `.ui.launch()` for a quick functional check or mount the stream on a FastAPI app for a custom frontend; the serving example uses `uvicorn app:app --host 0.0.0.0 --port 8000`.

Self-hosting the Python service does not make cloud-backed examples offline. A restricted network deployment must separately provision local inference and model files, and validate client connectivity. Release 0.0.34 added configurable OpenAPI tags for mounted endpoints and moved some print output to logging; 0.0.33 addressed Gradio Lite compatibility for versions before 5.46.0, and 0.0.32 fixed an async client instance reuse bug.
```

## Key Capabilities
```text
- Media handlers: `Stream` wraps a Python frame callback or an audio generator; the audio examples pass `(sample_rate, ndarray)` tuples.
- Speech turn handling: `ReplyOnPause` invokes reply logic on a detected pause; built-in pause detection and TTS use the `vad` and `tts` extras, respectively.
- Frontend integration: Launch the built-in Gradio UI with `.ui.launch()` or mount WebRTC and WebSocket endpoints on FastAPI with `.mount(app)`.
- Model integration: Examples span Whisper transcription, YOLOv10 webcam detection, Kyutai Moshi, and hosted Gemini and OpenAI real-time voice APIs.
- Telephone testing: `.fastphone()` provides a free temporary number for audio-only streams and requires a Hugging Face token.
- Runtime boundaries: Python 3.10+, Gradio >=4.0,<6.0, aiortc, and aioice >=0.10.1; the manifest adds audio compatibility dependencies for Python 3.13+.
```

## Quick Start / Clone
```bash
pip install fastrtc
```
