Skip to main content

English | 简体中文

agent-voice-input

PyPI version Python 3.10+ CI License

Context-aware voice input for CLI coding agents—grounded in your live session, repo, and SSH hosts.
Supports macOS and Windows + WSL2. Built for Codex, Claude Code, and Antigravity CLI (agy), while working out of the box across desktop IDEs and everyday apps.

🎙️ What you say casually to your terminal:
   "Uh check the default retry timeout in session router dot py, change it from
    five seconds to ten seconds—actually wait, make it fifteen seconds—and run
    the unit tests without piping to head"

❌ Generic OS dictation:
   Uh check the default retry timeout in session router dot pie change it from 5 seconds to 10 seconds actually wait make it 15 seconds and run the unit tests without piping to head

✅ agent-voice-input (grounded in active Agent session & repo, pasted without Enter):
   Check the default of retry_timeout_sec in session_router.py, change it to 15 seconds, and run the unit tests without piping to head.
  • Grounded in Your Active Context: Automatically reads the focused terminal, Ghostty split, tmux pane, desktop IDE workspace, or whitelisted SSH host—fixing filenames, symbols, and mid-sentence self-corrections with 50K block prefix caching.
  • Anti-Crosstalk & Paste-Only Safety: Locks onto the origin window on record start, injects directly without touching your clipboard in macOS Ghostty/tmux (snapshot & restore elsewhere), falls back to clipboard if focus drifts, and never auto-presses Enter.
  • Lightweight Pure Standard Library: Zero third-party Python dependencies (pure Python >= 3.10 + host ffmpeg + thin native shims, no Electron), with local silence gating, long-pause compression, and retry recovery for failed clips.
  • 100% Non-Interactive CLI: Zero y/n prompts and structured --json diagnostics, designed for both humans and coding agents.

Quick Start

Paste this single sentence into Claude Code, Codex, Antigravity (agy), or Cursor:

Follow https://github.com/xiaohuaxi/agent-voice-input/blob/main/docs/agent-setup.md to install and configure agent-voice-input on this machine (check ffmpeg/uv as needed), then walk me through my first voice dictation test.

Option B: Manual Setup

1. Install (handles Python >= 3.10 and PEP 668 automatically via uv; no sudo, no shell rc edits):

(tmp=$(mktemp) && trap 'rm -f "$tmp"' EXIT && curl -fsSL https://raw.githubusercontent.com/xiaohuaxi/agent-voice-input/main/install.sh -o "$tmp" && sh "$tmp")

(Already have uv? Run uv tool install --python '>=3.10' agent-voice-input directly. Need ffmpeg? macOS: brew install ffmpeg + xcode-select --install; WSL2: sudo apt update && sudo apt install -y ffmpeg.)

Zero-dependency install from git clone (Python >= 3.10 already installed)
git clone https://github.com/xiaohuaxi/agent-voice-input.git && mkdir -p ~/.local/bin
ln -s "$PWD/agent-voice-input/bin/agent-voice-input" ~/.local/bin/agent-voice-input

2. Initialize, add 1 API key & start (remember to remove the leading # when editing .env):

# 1) Create ~/.agent-voice-input/ (config.toml, .env, starter hotwords/personal.txt)
agent-voice-input init

# 2) Uncomment and add 1 ASR key in ~/.agent-voice-input/.env
#    Mainland China: DASHSCOPE_API_KEY (Bailian: https://bailian.console.aliyun.com/) or DEEPSEEK_API_KEY
#    Global:         OPENROUTER_API_KEY (https://openrouter.ai/keys), OPENAI_API_KEY, or GEMINI_API_KEY
#    (Existing local `codex` ChatGPT subscription login is auto-reused first by `auto`,
#     never Fast; to pin Codex including API-key mode, set `refiner.provider = "codex"`.)

# 3) Verify connectivity & start daemon (first run compiles native shim)
agent-voice-input doctor --ping && agent-voice-input start
  • Default hotkeys: MacBook built-in keyboards auto-default to Right Command (RCommand); desktop Macs (e.g., Mac mini) and Windows/WSL2 default to Right Ctrl (RControl). Tap <= 0.5s to start/stop; hold 0.8s to cancel.
  • macOS note: Always run agent-voice-input start from your local GUI terminal (not over SSH or launchd), and grant Microphone (+ Automation/Accessibility as prompted) to that terminal.

Supported Setups & 1-Key Recipes

  • Zero hooks needed for ~80% of workflows: macOS Ghostty (✅), Terminal.app (🧪), iTerm2 (🧪), local/remote tmux (✅), Antigravity 2.0 / ChatGPT Codex / Claude Desktop (✅ macOS), desktop IDEs (🧪), WSL2 single/distinct-dir windows (✅), and any everyday app (⚪) work out of the box. See the full Compatibility Matrix & User Guide.
Scenario Stage 1 (ASR) Stage 2 (Refiner) Key / Login Needed
Reuse Codex / AGY Login (Best Quality) dashscope, openrouter, doubao, openai, or deepseek codex (auto prefers ChatGPT subscription login first, never Fast; set refiner.provider = "codex" to pin, including API-key mode) or agy (opt-in) 1 Stage 1 key + local codex / agy login
Mainland China (CN / Mixed CN–EN) dashscope (qwen3-asr-flash, 150 terms / 1,800 chars) or doubao (bigmodel, 50 / 1,000) codex / agy / openrouter (or budget deepseek / dashscope) DASHSCOPE_API_KEY, or DOUBAO_SPEECH_API_KEY (Stage 2 refinement needs another LLM key or local codex/agy login)
Global 1-Key (High Quality Two-Stage) openrouter (microsoft/mai-transcribe-2, ~$0.10/hr) or openai (gpt-transcribe) openrouter (google/gemini-3.8-flash) or openai (gpt-6-luna) OPENROUTER_API_KEY or OPENAI_API_KEY
Minimal 1-Key Budget / Single-Hop deepseek (two-stage), dashscope (two-stage or qwen3.8-omni-flash), or gemini (single-hop) Built-in default or skipped in single-hop DEEPSEEK_API_KEY, DASHSCOPE_API_KEY, or GEMINI_API_KEY

Full 13-provider table, auto routing rules, and config.toml recipes: Providers & Models Guide.


Privacy & Data-Flow Commitments

  1. No Author Servers, Zero Middleman: No author-hosted servers, relays, or hidden telemetry. Audio and context go directly from your machine to the provider you explicitly configure (Apache-2.0 open source).
  2. No Audio or Transcripts Stored by Default: Status snapshots, logs, and diag.jsonl redact secrets and never write speech transcripts, session context, or hotwords. Failed/cancelled-in-flight clips stash (0600, 24h TTL, max 10) in failed/ for retry. Optional [archive] (save_transcripts 14-field JSONL with agent/agent_session_id, save_audio MP3) is off by default, 0700/0600, and gitignored.
  3. 0700/0600 Isolation & No Invasive Scraping: Reads only focused window metadata, plain-text CLI agent logs, and read-only AGY/Codex/Claude local session indexes—never VS Code/Cursor state.vscdb or chat/browser DOM trees. SSH probing queries only explicitly whitelisted hosts with zero remote keys.
  4. Scoped Context Only & Transparent auto: Coding mode sends only recent active dialogue and git status/shallow filenames—never your full repo. Default provider = "auto" checks env/.env keys and prefers local codex ChatGPT subscription login first for Stage 2 (agy is opt-in only); to pin Codex (including API-key mode) or another provider, set explicit providers (e.g., refiner.provider = "codex" or "off").

Daily CLI Cheatsheet

agent-voice-input init [--asr P] [--refiner P] [--hotkey K]   # Initialize ~/.agent-voice-input/
agent-voice-input start | restart | stop                      # Manage background daemon
agent-voice-input status [--history N] [--json]               # Health, active pipeline, archive & hotwords
agent-voice-input doctor [--ping] [--remote] [--json]         # Audio, shim, credentials, hooks & live ping
agent-voice-input diagnose [--last N] [--json]                # Latency p50, cache hits & redacted log tail
agent-voice-input retry --list                                # List stashed clips (safe recover: retry 1 --dry-run)
agent-voice-input hotwords list|add|remove|path               # Manage personal.txt (!pin & <- aliases)
agent-voice-input once --duration 4 --dry-run                 # Test capture & refinement without pasting
agent-voice-input integrate [--status] [--dry-run] [--json]   # Optional multi-window CLI hooks
agent-voice-input key-test                                    # Inspect raw key scancodes / modifiers
  • Personal hotwords: Edit ~/.agent-voice-input/hotwords/personal.txt (or run agent-voice-input hotwords add Term --pin --alias ...) to pin project names and fix recurring mishearings; hot-reloads on the next utterance.
  • Upgrade / Uninstall:
    • Upgrade: uv tool upgrade agent-voice-input && agent-voice-input restart (or re-run install.sh).
    • Uninstall program (preserves personal config & hotwords by default): agent-voice-input stop && uv tool uninstall agent-voice-input (optionally run agent-voice-input integrate --uninstall first); for complete cleanup of personal config, .env API keys, hotwords, caches, and shell auto-start, see the full uninstall checklist (~/.agent-voice-input/, ~/.cache/agent-voice-input/, ~/Library/Caches/agent-voice-input/ on macOS, %LOCALAPPDATA%\agent-voice-input\cache on Windows/WSL2).
  • Terminal auto-start (verify manual doctor --ping && start first; never use macOS launchd): Add this non-blocking snippet to ~/.zshrc or ~/.bashrc (scoped to standalone primary terminals—excludes SSH, $TMUX, and IDE integrated terminals):
    if [ -z "${SSH_CONNECTION:-}${TMUX:-}${ZED_TERM:-}" ] && [ "${TERMINAL_EMULATOR:-}" != "JetBrains-JediTerm" ]; then
      case "${TERM_PROGRAM:-}" in vscode|cursor|Cursor|windsurf|Windsurf|zed|Zed|trae|Trae|antigravity|Antigravity|kiro|Kiro) ;; *) command -v agent-voice-input >/dev/null 2>&1 && (agent-voice-input start >/dev/null 2>&1 &) ;; esac
    fi
    

Documentation

Security, Acknowledgments & License

  • Security: See SECURITY.md for vulnerability reporting and security boundaries.
  • Acknowledgments: Early exploration was inspired by Einstellung/voice-asr (pairing Qwen3-ASR with technical terminology context, silence gating, and loudness normalization).
  • License: Apache-2.0 License
  • Offline tests (source checkout): PYTHONPATH=src python3 -m unittest discover -s tests -v

Metadata

Release files for agent-voice-input 0.19.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-voice-input 0.19.1
File Size Uploaded Provenance Actions
agent_voice_input-0.19.1.tar.gz 1.6 MB With provenance Details for agent_voice_input-0.19.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-voice-input 0.19.1
File Interpreter ABI Platform Actions
agent_voice_input-0.19.1-py3-none-any.whl Python 3 none any Details for agent_voice_input-0.19.1-py3-none-any.whl

Total release size: 2.2 MB

Release files / agent_voice_input-0.19.1.tar.gz

Download URL agent_voice_input-0.19.1.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
29b69f9999d27d11bfeaab58de9349fe7c7b180dab100f182e64ba5555951b8e
BLAKE2b-256 checksum
How to use checksums
431657a4076a07d83afe6e08a53b84e5166468a0663aaa622f4f6012382cb2c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / agent_voice_input-0.19.1-py3-none-any.whl

Download URL agent_voice_input-0.19.1-py3-none-any.whl
Size 641.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1599310d510cf059eb5be2c7fc33b56f88c9639eb86795bf3f73a319c6bd6ffd
BLAKE2b-256 checksum
How to use checksums
13b8e6cf00a73d0feee98f1a5a84e94e4275b9961ec5412dc933876f3586ef3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for agent-voice-input 0.19.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agent_voice_input-0.19.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page