# huggingface/speech-to-speech — AlpLab Radar Static Code Audit

- Ring: `adopt`
- Category: `agents`
- Overall score: `3.9/5`
- Implementation check: `verified`
- Maturity: `active`
- Audited commit: `4343cddc7264` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-12-02T10:57:24Z
- Repository: https://github.com/huggingface/speech-to-speech
- Radar entry: https://radar.alplab.co/#repo/huggingface/speech-to-speech
- License: `Apache-2.0`
- CI workflows: `.github/workflows`
- Tags: `voice-agents`, `realtime`, `speech-to-speech`, `openai-compatible`, `local-inference`

## Summary

A configurable local or remote, OpenAI-Realtime-compatible voice-agent runtime composing VAD, STT, LLM, and streaming TTS backends.

## Implementation Check

README.md's local, swappable Realtime pipeline is implemented by cli.main, s2s_pipeline.build_pipeline, and backend_registry's typed backend factories.

## When to Use

Use for self-hosted voice agents where local execution, backend choice, and OpenAI Realtime compatibility matter. Do not expose its server directly to untrusted networks.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.5/5 |
| usability | 4.0/5 |
| reliability | 3.0/5 |
| security | 3.5/5 |
| integration | 4.5/5 |

## Code Evidence

- src/speech_to_speech/cli.py `main` dispatches `serve`, `talk`, and loopback `local` workflows.
- src/speech_to_speech/s2s_pipeline.py `build_pipeline` constructs isolated VAD, STT, LLM, and TTS units behind one server.
- src/speech_to_speech/backend_registry.py `BackendSpec` and `create_backend_handler` provide typed, lazy backend selection with optional-extra errors.
- src/speech_to_speech/api/openai_realtime/websocket_router.py `_release_unit_after_drain` quarantines stalled units to prevent cross-session output leakage.
- tests/test_chat.py exercises conversation ordering, tool-call lifecycle, eviction, and serialization edge cases.
- .github/workflows/ci.yml runs Ruff, mypy, pytest across Python 3.11–3.14, browser integration, packaging, and install smoke checks.

## Issues Found

- src/speech_to_speech/arguments_classes/realtime_server_arguments.py explicitly permits an unauthenticated API on `0.0.0.0`; deploy it only behind access controls.
- src/speech_to_speech/s2s_pipeline.py performs `nltk.download` during import when resources are missing, creating implicit startup network access.
- pyproject.toml leaves many core dependency versions as lower-bounded ranges, so environment resolution can vary over time.

## Key Risks

- pyproject.toml requires Python 3.11+ and ships heavyweight Torch, Transformers, audio, and platform-specific dependencies.
- README.md documents 24 GB VRAM for the default Linux NVIDIA LLM path; CPU fallback is expected to be slow.
- src/speech_to_speech/s2s_pipeline.py downloads required NLTK data during module import when absent.
- Optional backends and remote OpenAI-compatible providers add distinct dependency, credential, and data-egress requirements.

## Reviewed Files

- `README.md`
- `pyproject.toml`
- `src/speech_to_speech/cli.py`
- `src/speech_to_speech/s2s_pipeline.py`
- `src/speech_to_speech/backend_registry.py`
- `src/speech_to_speech/api/openai_realtime/server.py`
- `src/speech_to_speech/api/openai_realtime/websocket_router.py`
- `src/speech_to_speech/arguments_classes/realtime_server_arguments.py`
- `tests/test_chat.py`
