An AI-powered coding assistant you control entirely with your voice.
Speak a feature, describe a bug, ask for a refactor — voice2code understands and executes it in real time.
voice2code is an open-source, voice-native coding assistant that lets you build software by simply talking. No keyboard. No typing. Just describe what you want — and the AI agent understands your intent, runs the right commands, and writes the code.
Inspired by tools like Cursor and Claude Code, but designed around a conversational, voice-first workflow.
You: "Create a Python script that reads a CSV and outputs a summary"
AI: *creates the file, writes the code, runs it, shows you the output*
- Voice to Code — Speak naturally; the agent translates intent to action
- Agentic Loop — Powered by LangGraph, the AI reasons over multi-step tasks autonomously
- Shell Execution — The agent can run real terminal commands on your machine
- GPT-4.1 Brain — State-of-the-art reasoning for code generation and debugging
- Extensible Tools — Add your own LangChain tools to expand agent capabilities
- Minimal Setup — Two files, one
.env, and you're running
Microphone → Speech Recognition → LangGraph Agent → Tool Execution → Response
- SpeechRecognition captures audio from your mic and transcribes it via Google Speech API
- The transcript is sent into a LangGraph StateGraph as a user message
- The chatbot node (GPT-4.1) decides whether to call a tool or respond directly
- If a tool is needed, the tools node executes shell commands on your machine
- The result feeds back into the agent until the task is complete
- Python 3.9+
- A microphone connected to your machine
- An OpenAI API key
git clone https://github.com/your-username/voice2code.git
cd voice2codepython3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtmacOS users: PyAudio requires PortAudio. Install it first:
brew install portaudio
Linux users:
sudo apt-get install python3-pyaudio portaudio19-dev
Create a .env file in the project root:
OPENAI_API_KEY=sk-your-key-herepython3 main.pyThe agent will start listening. Speak your instruction and watch it go.
Once running, just speak naturally:
| You say | What happens |
|---|---|
| "List the files in the current directory" | Runs ls, shows output |
| "Create a folder called my-project" | Runs mkdir my-project |
| "Write a Python script that prints Hello World" | Creates and writes the file |
| "Read the contents of main.py" | Runs cat main.py, reads it back |
| "Refactor that function to use a list comprehension" | Modifies the file in place |
All generated files are saved in the
chat_gpt/folder by default.
voice2code/
├── main.py # Entry point — mic loop + agent streaming
├── graph.py # LangGraph agent: nodes, tools, edges
├── requirements.txt
├── .env # Your secrets (not committed)
├── docs/
│ ├── context.md # Project context for the AI assistant
│ └── logs.md # Session logs
└── chat_gpt/ # AI-generated output files
Adding a new tool is straightforward:
# graph.py
from langchain_core.tools import tool
@tool
def read_file(path: str):
"""Reads and returns the contents of a file at the given path."""
with open(path, "r") as f:
return f.read()
available_tools = [run_command, read_file] # add it hereThe agent automatically learns to use it from the docstring.
- Wake word detection ("Hey voice2code...")
- Multi-file context awareness
- Voice feedback / text-to-speech responses
- Web UI / Electron desktop app
- Plugin system for custom tool packs
- Support for more LLM providers (Claude, Gemini, local models)
Contributions are welcome! Here's how to get started:
- Fork the repo
- Create a feature branch:
git checkout -b feat/your-feature - Commit your changes:
git commit -m "feat: add your feature" - Push and open a Pull Request
Please keep PRs focused and include a clear description of the change.
MIT — free to use, modify, and distribute. See LICENSE for details.
Built with curiosity and a microphone.
Star the repo if you think talking to your computer should be the future.