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

- **GitHub URL**: https://github.com/dimastatz/whisper-flow
- **Official Docs / Website**: https://github.com/dimastatz/whisper-flow
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A+ (94/100 · Maintenance 35/35 · Adoption 19/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v1.4.0 (2026-11-01) — https://github.com/dimastatz/whisper-flow/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Docker, Self-Hosted, Local AI, API
- **Momentum**: 1,029 ★ total (+2 24h / +5 7d) · 145 forks
- **Topics**: `pypi-package`, `python`, `speech-to-text`, `transcription`, `whisper`
- **When to Use**: Best for: Teams building self-hosted live captions or speech-to-text features that can supply 16 kHz PCM and render revisable partial results. Skip if: You only transcribe completed files, or you require stable interim text and proven tail latency at scale without benchmarking and operating the inference stack yourself.

## Overview
```text
### Architecture & Core Mechanics
Whisper-Flow is a Python SDK and self-hosted FastAPI service that adds streaming session semantics around OpenAI Whisper. The Uvicorn-served API accepts binary PCM on `/ws`; `whisperflow.streaming.TranscribeSession` groups chunks into temporal windows and coordinates transcription callbacks and result delivery. `whisperflow.transcriber` provides synchronous and asynchronous PCM chunk helpers over the `openai-whisper`, PyTorch, and NumPy stack. PyAudio and PortAudio serve audio I/O; the WebSocket contract starts with PCM already prepared by the client.

The callback boundary lets an application embed session handling without adopting the supplied server. The primary abstraction is windowed transcription with partial and final events, not a native streaming Whisper decoder or a provider-switching layer. Since v1.3.0, `get_model()` returns a replica pool: each replica runs one transcription at a time, so concurrent sessions no longer have to invoke the same model instance simultaneously. Async integration helps coordinate I/O, but inference capacity is still limited by the available replicas and hardware.

### Key Capabilities & Differentiators
Clients send 16 kHz mono signed 16-bit PCM in binary WebSocket frames and receive JSON events with `is_partial`, `data.text`, and `time` in milliseconds. Optional JSON control frames include `start` to select a model, language, and vocabulary prompt, plus `flush` and `stop`. A pause, stable text, or the window cap can also finalize a segment. Partial output can revise previously emitted words, so a caption UI should replace its current preview rather than append every event.

The default checkpoint is `tiny.en.pt`; `list_models()` lists model files in `whisperflow/models/`, and `GET /ready` reports the available models and `protocol_version`. The transcription helpers accept a language and an optional `prompt` mapped to Whisper's `initial_prompt`, a hint rather than a vocabulary constraint. The service also exposes `POST /transcribe_pcm_chunk` for batch PCM input. The LibriSpeech benchmark measures Word Error Rate and intervals between consecutive partial results; that latency metric is not capture-to-final delay or a throughput guarantee under load.

### Trade-offs & Limitations
Compared with invoking OpenAI Whisper directly on complete recordings, Whisper-Flow supplies the windowing, endpointing, event protocol, and concurrency controls needed for live captions. The trade-off is that partial text is provisional and shorter windows can reduce context and accuracy. A dedicated streaming ASR backend is worth comparing when stable interim text or stringent tail latency matters; a managed speech API is an alternative when avoiding model operations matters more than keeping audio on infrastructure you control.

Replica isolation improves concurrency safety at the cost of additional model memory. v1.4.0 bounds the per-session input backlog, addressing a queue that could grow while transcription was busy; `WF_MAX_WINDOW_CHUNKS` only applied after chunks left that queue. Neither bound establishes service-wide capacity or a latency SLA. Size CPU or GPU deployments against the selected checkpoint and target concurrency, and test slow inference and bursty clients. The supplied material does not establish production authentication or admission controls, so verify those before exposing the API publicly.

### Hardware & Deployment Guide
The local workflow is `./run.sh -local` to create a virtual environment, install dependencies, and run checks, followed by `./run.sh -run-server` on port 8181. `GET /health` checks whether the server is running, while `/ready` exposes model and protocol information. Python 3.12 is the tested version and the base of the supplied `python:3.12-slim-bookworm` image. Allow for PyAudio's PortAudio dependency, PyTorch, and provisioning the selected model files. Inference runs locally once dependencies and weights are available; this does not make installation network-free.

Check the Docker path before adopting it as a release workflow. `./run.sh -docker` uses port 8888, while the manual example builds `Dockerfile.test` and maps port 8181. The root `Dockerfile` copies the checkout but runs `pip install whisperflow`, not `pip install .`; its import and callable checks do not establish that the image is testing the checkout. Validate the intended package and port mapping before rollout. When upgrading, exercise concurrent sessions for the v1.3.0 replica change and test faster-than-real-time input for the v1.4.0 backlog change.
```

## Key Capabilities
```text
- Transport: `/ws` accepts binary 16 kHz mono signed int16 PCM and returns JSON with `is_partial`, `data.text`, and `time` in milliseconds.
- Finalization: Pauses, stable text, the window cap, and explicit `flush` or `stop` can finalize a segment.
- SDK: `TranscribeSession` takes separate transcription and delivery callbacks; `whisperflow.transcriber` exposes sync and async PCM helpers.
- Model concurrency: The v1.3.0 replica pool allows one transcription at a time per replica, avoiding concurrent calls on the same Whisper instance.
- Backlog control: v1.4.0 bounds the per-session audio backlog separately from the processing window.
- Readiness and benchmarking: `GET /ready` exposes protocol version and available models; `./run.sh -benchmark` measures WER and inter-partial latency with LibriSpeech.
```

## Quick Start / Clone
```bash
brew install portaudio
```
