- Add release.yml: builds and deploys to dist branch on push to main - Add GitHub Releases creation on version tags - Update vite.config.ts: updateURL/downloadURL point to dist branch - Update README: one-click install links for PC and Android - Add auto-update documentation (EN/RU) - Add manual install from Releases instructions - Revert dist/ from gitignore (built by CI, not committed) |
||
|---|---|---|
| .github | ||
| src | ||
| tests | ||
| .gitignore | ||
| .nvmrc | ||
| biome.json | ||
| knip.json | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| vite-env.d.ts | ||
| vite.config.ts | ||
| vitest.config.ts | ||
OpenCode Voice Dictation / Голосовая диктовка для OpenCode
Voice dictation for OpenCode web interface using OpenAI Whisper via Groq API. Works on both desktop and mobile browsers through a Tampermonkey/Violentmonkey userscript.
Голосовая диктовка для веб-интерфейса OpenCode с использованием OpenAI Whisper через Groq API. Работает как на десктопных, так и на мобильных браузерах через юзерскрипт Tampermonkey/Violentmonkey.
English
Features
- Whisper large-v3 transcription via Groq API (same quality as Cursor)
- Tap-to-toggle recording (tap to start, tap to stop)
- Noise suppression + echo cancellation (great for outdoor use)
- Recording timer (MM:SS display)
- Ctrl+Space keyboard shortcut on desktop
- Custom Whisper prompt for software development context
- Auto-detect language (Russian + English technical terms)
- Auto-submit option (configurable)
- No backend needed — API calls go directly from browser via
GM_xmlhttpRequest
Requirements
| Component | Requirement |
|---|---|
| OpenCode | Web interface running (opencode web) |
| Groq API key | Free at console.groq.com/keys |
| PC Browser | Vivaldi / Chrome / Firefox + Violentmonkey or Tampermonkey |
| Mobile Browser | Firefox for Android + Tampermonkey |
Compatibility
| Platform | Browser | Userscript Manager | Status |
|---|---|---|---|
| Desktop (Linux/macOS/Windows) | Vivaldi | Violentmonkey | ✅ Supported |
| Desktop | Chrome | Tampermonkey | ✅ Supported |
| Desktop | Firefox | Tampermonkey | ✅ Supported |
| Android | Firefox | Tampermonkey | ✅ Supported |
| Android | Vivaldi | — | ❌ No extension support |
| Android | Chrome | — | ❌ No extension support |
Install
One-click install: Open this link in your browser with Violentmonkey/Tampermonkey installed:
Your userscript manager will intercept the download and show an installation dialog.
Desktop (Vivaldi + Violentmonkey)
- Install Violentmonkey extension in Vivaldi
- Click the Install Script link
- Confirm installation in the Violentmonkey dialog
Android (Firefox + Tampermonkey)
- Install Firefox for Android from Play Store
- Install Tampermonkey from Firefox Add-ons
- In Firefox, open the Install Script link
- Confirm installation in the Tampermonkey dialog
Manual install (from GitHub Releases)
- Go to Releases
- Download
opencode-voice-dictation.user.jsfrom the latest release - Open Violentmonkey/Tampermonkey dashboard → + → paste the file contents → Save
Setup
- Get a free Groq API key at console.groq.com/keys
- Open any OpenCode web page
- Open Violentmonkey/Tampermonkey menu → "Set Groq API Key"
- Paste your key (
gsk_...)
Auto-Update
The script updates automatically. No action needed.
@updateURLchecks for new versions periodically (every 24h in Tampermonkey, every 7 days in Violentmonkey)- Only a tiny
.meta.js(~1KB) is downloaded to check the version - If a new version is found, the full
.user.js(~18KB) is downloaded and installed - Updates are published automatically by CI when code is pushed to
main
Usage
- Open OpenCode web in your browser
- A microphone button appears next to the chat input
- Tap the button to start recording (red pulse + timer)
- Tap again to stop — audio is transcribed and inserted into the input
- (Desktop) Press Ctrl+Space as an alternative to clicking
Configuration
All settings available via the Violentmonkey/Tampermonkey menu:
| Menu Item | Description |
|---|---|
| Set Groq API Key | Enter your gsk_... key |
| Toggle Auto-Submit | Auto-send message after transcription |
| Set Whisper Model | whisper-large-v3 (default) or whisper-large-v3-turbo (faster) |
| Set Language | Language code (e.g., ru, en) or empty for auto-detect |
| Set Whisper Prompt | Context prompt for transcription accuracy |
Русский
Возможности
- Whisper large-v3 транскрипция через Groq API (качество как в Cursor)
- Tap-to-toggle запись (тапнул — начал, тапнул — стоп)
- Шумоподавление + эхоподавление (для записи на улице)
- Таймер записи (формат MM:SS)
- Ctrl+Space горячая клавиша на ПК
- Кастомный Whisper prompt для контекста разработки
- Авто-определение языка (русский + английские технические термины)
- Авто-отправка опционально (настраивается)
- Без бэкенда — запросы идут напрямую из браузера через
GM_xmlhttpRequest
Требования
| Компонент | Требование |
|---|---|
| OpenCode | Запущенный веб-интерфейс (opencode web) |
| Groq API ключ | Бесплатно на console.groq.com/keys |
| Браузер ПК | Vivaldi / Chrome / Firefox + Violentmonkey или Tampermonkey |
| Браузер телефон | Firefox для Android + Tampermonkey |
Совместимость
| Платформа | Браузер | Менеджер скриптов | Статус |
|---|---|---|---|
| Десктоп (Linux/macOS/Windows) | Vivaldi | Violentmonkey | ✅ Поддерживается |
| Десктоп | Chrome | Tampermonkey | ✅ Поддерживается |
| Десктоп | Firefox | Tampermonkey | ✅ Поддерживается |
| Android | Firefox | Tampermonkey | ✅ Поддерживается |
| Android | Vivaldi | — | ❌ Нет поддержки расширений |
| Android | Chrome | — | ❌ Нет поддержки расширений |
Установка
Установка в один клик: Откройте эту ссылку в браузере с установленным Violentmonkey/Tampermonkey:
Менеджер скриптов перехватит загрузку и покажет диалог установки.
ПК (Vivaldi + Violentmonkey)
- Установите расширение Violentmonkey в Vivaldi
- Нажмите на ссылку Установить скрипт
- Подтвердите установку в диалоге Violentmonkey
Android (Firefox + Tampermonkey)
- Установите Firefox для Android из Play Store
- Установите Tampermonkey из дополнений Firefox
- В Firefox откройте ссылку Установить скрипт
- Подтвердите установку в диалоге Tampermonkey
Ручная установка (из GitHub Releases)
- Перейдите на страницу Releases
- Скачайте
opencode-voice-dictation.user.jsиз последнего релиза - Откройте панель Violentmonkey/Tampermonkey → + → вставьте содержимое файла → Сохранить
Настройка
- Получите бесплатный ключ Groq на console.groq.com/keys
- Откройте любую страницу OpenCode web
- Откройте меню Violentmonkey/Tampermonkey → "Set Groq API Key"
- Вставьте ваш ключ (
gsk_...)
Автообновление
Скрипт обновляется автоматически. Ничего делать не нужно.
@updateURLпериодически проверяет новые версии (каждые 24ч в Tampermonkey, каждые 7 дней в Violentmonkey)- Скачивается только маленький
.meta.js(~1KB) для проверки версии - Если найдена новая версия — скачивается полный
.user.js(~18KB) и устанавливается - Обновления публикуются автоматически CI при пуше в
main
Использование
- Откройте OpenCode web в браузере
- Рядом с полем ввода появится кнопка микрофона
- Тапните кнопку для начала записи (красная пульсация + таймер)
- Тапните снова для остановки — аудио транскрибируется и вставляется в поле ввода
- (На ПК) Нажмите Ctrl+Space как альтернативу клику
Настройки
Все параметры доступны через меню Violentmonkey/Tampermonkey:
| Пункт меню | Описание |
|---|---|
| Set Groq API Key | Ввести ключ gsk_... |
| Toggle Auto-Submit | Автоматическая отправка после транскрипции |
| Set Whisper Model | whisper-large-v3 (по умолчанию) или whisper-large-v3-turbo (быстрее) |
| Set Language | Код языка (например, ru, en) или пусто для авто-определения |
| Set Whisper Prompt | Контекстный промпт для точности транскрипции |
Development / Разработка
Prerequisites
- Node.js 22+
- npm
Setup
git clone https://github.com/slaid098/opencode-voice-dictation.git
cd opencode-voice-dictation
npm install
Commands
| Command | Description |
|---|---|
npm run dev |
Development mode with auto-reload |
npm run build |
Build to dist/opencode-voice-dictation.user.js |
npm run lint |
Lint with Biome |
npm run format |
Format with Biome |
npm run typecheck |
TypeScript type checking |
npm run test |
Run tests with coverage (60% threshold) |
npm run knip |
Find unused code |
Project Structure
src/
├── index.ts # Entry point — orchestrates all modules
├── config.ts # GM storage, defaults, validation, menu commands
├── audio.ts # MediaRecorder, getUserMedia, audio constraints
├── transcribe.ts # Groq API call, FormData builder, error parsing
├── insert.ts # Contenteditable text insertion + InputEvent dispatch
├── ui.ts # Button injection, MutationObserver, toast notifications
├── keyboard.ts # Ctrl+Space keyboard shortcut handler
└── types.ts # Shared TypeScript types
tests/
├── transcribe.test.ts # FormData format, error parsing (5 tests)
├── insert.test.ts # Contenteditable insertion, event dispatch (5 tests)
├── config.test.ts # Defaults, key validation, state (9 tests)
├── audio.test.ts # Time formatting (5 tests)
└── __mocks__/$/ # Mock for GM_api functions
CI/CD
- Lint: Biome (recommended rules,
noExplicitAny: error) - Typecheck:
tsc --noEmit - Knip: Dead code detection
- Test: Vitest + happy-dom, 60% coverage threshold
- Build: Vite → single
.user.jsfile - Dependabot: Weekly npm + GitHub Actions updates
License
MIT — see LICENSE