[PR #11345] feat: add first-party voice transcription with local Whisper #13748

Open
opened 2026-02-16 18:18:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11345

State: open
Merged: No


What does this PR do?

Implements first-party, local voice transcription using Whisper.cpp via @huggingface/transformers. All processing happens locally with zero configuration required.

Features

  • Privacy-first: All transcription happens locally, no external API calls
  • Zero configuration: Works out of the box after enabling in /status
  • Offline support: Works completely offline after initial model download
  • Three model sizes: tiny (75MB), base (142MB, default), small (466MB)
  • Customizable keybind: Default \ for recording, configurable in ~/.config/opencode/opencode.json

This follows the frontend-backend separation design of OpenCode:

  • TUI: Uses sox/ffmpeg for microphone recording (tested on Linux)

Usage

  1. Enable voice in /status dialog
  2. Wait for model download (one-time, ~142MB for base model)
  3. Press \ to start recording
  4. Speak clearly
  5. Press \ again to stop
  6. Transcribed text appears in prompt input

Models are cached in ~/.cache/opencode/models/ and persist across sessions.

Comparison with PR #9264

PR #9264 implements voice via external APIs (Groq/OpenAI/local whisper-fastapi). This implementation prioritizes privacy and simplicity. Both approaches have merit. This implementation aligns with OpenCode's philosophy of local-first, privacy-respecting tooling.

Fixes #2425
Fixes #4695

How did you verify your code works?

  • All 792 tests pass, TypeScript compiles cleanly
  • Manually tested: recording with \ keybind, model download/caching, transcription accuracy
  • Verified config persistence, auto-start, offline mode with cached models
  • Tested on Linux with sox/ffmpeg (macOS/Windows unverified but should work)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11345 **State:** open **Merged:** No --- ### What does this PR do? Implements **first-party, local voice transcription** using Whisper.cpp via `@huggingface/transformers`. All processing happens locally with zero configuration required. ### Features - **Privacy-first**: All transcription happens locally, no external API calls - **Zero configuration**: Works out of the box after enabling in `/status` - **Offline support**: Works completely offline after initial model download - **Three model sizes**: tiny (75MB), base (142MB, default), small (466MB) - **Customizable keybind**: Default `\` for recording, configurable in `~/.config/opencode/opencode.json` This follows the frontend-backend separation design of OpenCode: - **TUI**: Uses sox/ffmpeg for microphone recording (tested on Linux) ### Usage 1. Enable voice in `/status` dialog 2. Wait for model download (one-time, ~142MB for base model) 3. Press `\` to start recording 4. Speak clearly 5. Press `\` again to stop 6. Transcribed text appears in prompt input Models are cached in `~/.cache/opencode/models/` and persist across sessions. ### Comparison with PR #9264 PR #9264 implements voice via external APIs (Groq/OpenAI/local whisper-fastapi). This implementation prioritizes privacy and simplicity. Both approaches have merit. This implementation aligns with OpenCode's philosophy of local-first, privacy-respecting tooling. Fixes #2425 Fixes #4695 ### How did you verify your code works? - All 792 tests pass, TypeScript compiles cleanly - Manually tested: recording with `\` keybind, model download/caching, transcription accuracy - Verified config persistence, auto-start, offline mode with cached models - Tested on Linux with sox/ffmpeg (macOS/Windows unverified but should work)
yindo added the pull-request label 2026-02-16 18:18:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13748