Voice input plugin for OpenCode with PyQt5 stop button and ntfy.sh notifications.
- 🎙 Voice Recording - Record audio with a floating PyQt5 stop button
- 📍 Smart Positioning - Button appears at bottom-right of Terminal window
- 🔔 ntfy.sh Notifications - Get notified when to speak, when transcribing, and the result
- 🇫🇷 French Whisper - Uses
mediummodel for accurate French transcription - ✅ Visual Feedback - Button changes color: 🔴 → ⏳ → ✅/❌
| Command | Description |
|---|---|
/talk |
Record voice, transcribe, and auto-send as message |
/speak |
Ask AI to speak in French with elia-speak |
macOS requires:
sox(for audio recording)- Python 3.10+ with pip
- OpenCode CLI
brew install soxPython packages:
pip install -r requirements.txtOr manually:
pip install openai-whisper PyQt5mkdir -p ~/.config/opencode/commandsCopy these files to ~/.config/opencode/commands/:
talk.md- Voice recording commandspeak.md- French summary commandvoice_record.py- Main Python script
cp talk.md speak.md voice_record.py ~/.config/opencode/commands/
chmod +x ~/.config/opencode/commands/voice_record.pyThe plugin uses ntfy.sh/OpenCode topic for notifications.
Option A: Use default (public)
No setup needed. Install ntfy app and subscribe to OpenCode topic.
Option B: Use private topic
Edit voice_record.py and change:
def notify(msg):
subprocess.run(
["curl", "-s", "-X", "POST", "https://ntfy.sh/YOUR_TOPIC", "-d", msg],
capture_output=True,
)The first run will download the medium model (~1.5GB). To pre-download:
python3 -c "import whisper; whisper.load_model('medium')"- Type
/talkin OpenCode - A 🔴 red stop button appears at bottom-right of Terminal
- Speak your message
- Click ⏹ Stop (or wait 60s timeout)
- Button turns ⏳ blue during transcription
- Button turns ✅ green with notification containing transcript
- Transcript is auto-inserted and sent as chat message
Type /speak to ask the AI to speak in French using elia-speak with Kokoro TTS. The AI will prefix the message with "Speak about the :" followed by the content to be spoken.
┌─────────────────────────────────────────────────────┐
│ User types /talk │
│ ↓ │
│ voice_record.py launches │
│ ↓ │
│ 🔴 Red button appears (bottom-right of Terminal) │
│ ↓ │
│ ntfy notification: "🎙 Parle maintenant..." │
│ ↓ │
│ User clicks ⏹ Stop │
│ ↓ │
│ ⏳ Blue button (transcribing...) │
│ ↓ │
│ ntfy notification: "⏳ Transcription..." │
│ ↓ │
│ Whisper (medium model) transcribes in French │
│ ↓ │
│ ✅ Green button │
│ ↓ │
│ ntfy notification: "✅ [transcript]" │
│ ↓ │
│ Transcript printed → OpenCode sends as message │
└─────────────────────────────────────────────────────┘
~/.config/opencode/commands/
├── talk.md # Command: record voice
├── speak.md # Command: French summary
└── voice_record.py # Main Python script
~/.config/opencode/plugins/
└── voice.ts # (Optional) Plugin alternative
brew install soxpip install openai-whisperpip install PyQt5The script uses AppleScript to detect Terminal/iTerm2 window position. Grant Accessibility permissions if needed:
- System Preferences → Security & Privacy → Privacy → Accessibility
- Add Terminal/iTerm
Check your ntfy.sh topic. Default is OpenCode. Install the ntfy app and subscribe to your topic.
First run downloads the model (~1.5GB). Subsequent runs use cached model.
Edit voice_record.py to customize:
TMP_FILE = "/tmp/opencode_voice.wav" # Temp audio file
WHISPER_MODEL = "medium" # Model: tiny/base/small/medium/large
WHISPER_LANG = "fr" # Language code
NTFY_TOPIC = "OpenCode" # ntfy.sh topic- macOS (uses AppleScript for window detection)
- sox (
brew install sox) - Python 3.10+
- openai-whisper
- PyQt5