Back to the catalog

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)

![Works with both - claude code and gemini cli](screenshots/cc-gc-stts.png)

## 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.

![Speak](screenshots/stt.png)

- **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.

![Hear](screenshots/tts.png)

## 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

More