gemini-stts
Talk to gemini cli and hear gemini cli talk back.
Open source Open in the app JSON README (API)
About
Talk to gemini cli and hear gemini cli talk back.
Details
- Kind
- Plugins
- Topic
- AI, RAG & memory
- Publisher
- sandipchitale
- Origin
- gemini
- Category
- ferramentas
- Version
- 1.0.0
- Last push
- 2026-04-14T05:44:48Z
- Repository state
- ativo
- Language
- HTML
- Added
- 2026-08-30 14:13:39
- Updated
- 2026-08-30 14:13:39
- Origin id
sandipchitale/gemini-stts
README
# gemini-stts
A Gemini CLI extension that adds speech-to-text (STT) and text-to-speech (TTS) capabilities to the Gemini CLI. Speak your prompts instead of typing them, and hear Gemini CLI's responses read aloud.
If you are looking for claude code alternative... [claude-stts](https://github.com/sandipchitale/claude-stts)

## Features
- **Speech-to-Text (`/t`)** - Dictate your prompt using your microphone via a Chrome-based UI powered by the Web SpeechRecognition API
- **Text-to-Speech (`/h`)** - Have Gemini CLI's response (or any text) spoken aloud using the browser's SpeechSynthesis API
- **Combined STT + TTS (`/th`)** - Speak your prompt and automatically hear the response -- a full voice conversation flow
- **Looping STT (`/tl`)** - Like `/t`, but keeps re-opening the dictation dialog after each prompt until you cancel it
- **Looping STT + TTS (`/thl`)** - Like `/th`, but stays in a continuous speak-and-listen loop until you cancel the dialog
### Voice Commands (STT)
While dictating, you can use voice commands for hands-free editing:
| Command | Action |
|---|---|
| `insert comma / period / question mark / exclamation mark / tab` | Inserts the corresponding punctuation or character |
| `new paragraph` | Ends the current sentence and starts a new paragraph |
| `go to start / go to end` | Moves cursor to the beginning or end of the text |
| `select all` | Selects all text |
| `unselect selection` | Collapses the selection without deleting |
| `delete selection` | Deletes the selected text |
| `undo it / redo it` | Undo or redo the last action |
A built-in cheat sheet for these voice commands is also available via the ๐ฃ๏ธ button in the STT dialog.
### Keyboard Shortcuts (STT)
| Shortcut | Action |
|---|---|
| `Ctrl+R` | Toggle speech recognition on/off |
| `Enter` | Send the prompt |
| `Shift+Enter` | Insert a new line |
| `Escape` | Stop recording / cancel |
## How It Works
The plugin launches a Chrome instance (via [chrome-launcher](https://www.npmjs.com/package/chrome-launcher)) in app mode and connects to it using [puppeteer-core](https://www.npmjs.com/package/puppeteer-core). This approach leverages the browser's native `SpeechRecognition` and `SpeechSynthesis` APIs, which provide high-quality speech processing without requiring any external API keys or services.
- **STT flow**: Opens a Chrome window with a textarea where you can type or dictate. Microphone permission is automatically granted via Puppeteer. When you click "Send" or press Enter, the text is printed to stdout, which Gemini CLI captures and processes as your prompt.

- **TTS flow**: Opens a Chrome window that receives text via Puppeteer's `evaluateOnNewDocument`, then speaks it using `SpeechSynthesisUtterance`. Supports a `--oneshot` flag to automatically close after speaking.

## Architecture
```
gemini-stts/
โโโ commands/
โ โโโ t.toml # /t command - speech-to-text
โ โโโ tl.toml # /tl command - looping speech-to-text
โ โโโ h.toml # /h command - text-to-speech
โ โโโ th.toml # /th command - combined STT + TTS
โ โโโ thl.toml # /thl command - looping STT + TTS
โโโ src/
โ โโโ chrome-sidekick.ts # Chrome launcher and Puppeteer connection utilities
โ โโโ stt.ts # STT entry point - launches Chrome with speech recognition UI
โ โโโ stt_ui.html # STT frontend - textarea with SpeechRecognition integration
โ โโโ tts.ts # TTS entry point - launches Chrome with speech synthesis UI
โ โโโ tts_ui.html # TTS frontend - textarea with SpeechSynthesis integration
โโโ dist/ # Pre-built bundles (committed so users don't need `npm install`)
โ โโโ stt.mjs # Bundled STT entry point
โ โโโ tts.mjs # Bundled TTS entry point
โ โโโ stt_ui.html # Copied at build time
โ โโโ tts_ui.html # Copied at build time
โโโ build.mjs # esbuild build script
โโโ gemini-extension.json # Gemini CLI extension manifest
โโโ package.json
โโโ tsconfig.json
```
## Prerequisites
- **Node.js** (v18+)
- **Google Chrome** or Chromium installed on your system
- A working **microphone** for speech-to-text
## Installation
### As a Gemini CLI Extension
Install directly from the repository:
```bash
gemini extension link .
```
The repository ships with pre-built bundles in `dist/`, so **no `npm install` is required** for end users. The slash commands invoke `node ${extensionPath}/dist/stt.mjs` and `dist/tts.mjs` directly.
### For Local Development
```bash
git clone https://github.com/sandipchitale/gemini-stts.git
cd gemini-stts
npm install
npm run build # bundles src/*.ts into dist/ via esbuild
```
Then add it as a local marketplace and plugin in Gemini CLI:
```bash
git clone https://github.com/sandipchitale/gemini-stts.git
cd gemini-stts
gemini extension link .
```
The build script (`build.mjs`) uses [esbuild](https://esbuild.github.io/) to bundle `src/stt.ts` and `src/tts.ts` into standalone ESM files under `dist/`, and copies the HTML UI assets alongside them. Re-run `npm run build` after any change in `src/`.
## Usage
Once installed, use the slash commands in Gemini CLI:
```
/t [initial text] # Speak your prompt
/tl # Speak your prompt in a loop until cancelled
/h # Hear Gemini CLI's last response
/h prompt text # Hear specific text spoken aloud
/th [initial text] # Speak your prompt and hear the response
/thl [initial text] # Speak-and-hear in a loop until cancelled
```
All slash commands accept optional text arguments that pre-populate the dictation textarea, e.g.:
```
/t Write a haiku about
/h The quick brown fox jumps over the lazy dog
```
## Dependencies
- [chrome-launcher](https://www.npmjs.com/package/chrome-launcher) - Launches Chrome with custom flags
- [puppeteer-core](https://www.npmjs.com/package/puppeteer-core) - Connects to and controls the Chrome instance
- [commander](https://www.npmjs.com/package/commander) - CLI argument parsing
- [esbuild](https://esbuild.github.io/) (dev) - Bundles `src/*.ts` into `dist/*.mjs` so the plugin runs without `npm install`
## License
MIT
## Author
Sandip Chitale