This repository contains two terminal-based applications that integrate with OpenRouter's Deepseek model:
- TerminalGPT (gpt.py) - An interactive chatbot that allows you to converse with an AI in your terminal.
- AI Shell Assistant (exe.py) - A tool that translates natural language requests into shell commands and executes them safely.
- Chat with an AI in real time from your terminal.
- Maintains conversation history during the session.
- Converts plain-English requests into complete, executable shell commands.
- Sanitizes generated commands and prompts for confirmation before executing.
- Automatically handles errors with a retry mechanism.
These instructions are aimed at Mac users who are new to using the Terminal.
- macOS with Python 3.6 or higher installed.
- Homebrew package manager (if not installed, see below).
- Basic familiarity with the Terminal application.
- Open Safari and navigate to https://brew.sh/.
- Follow the instructions on the website to install Homebrew.
- Press
Cmd + Space, type Terminal, and pressEnter.
In the Terminal, run:
brew install pythonThis installs the latest version of Python 3 along with pip, Python's package installer.
Choose a directory (for example, your Desktop) and run:
cd ~/Desktop
git clone https://github.com/EricSpencer00/TerminalGPT.git
cd TerminalGPTIt is recommended to use a virtual environment:
python3 -m venv venv
source venv/bin/activateYour Terminal prompt should now start with (venv).
Install the dependencies using:
pip install -r requirements.txtIf a requirements.txt file is not provided, you can create one with at least the following packages:
openai
python-dotenv
termcolor
Both applications require your Deepseek key from OpenRouter.
- In the project directory, create a file named
.env:touch .env
- Open the
.envfile in your preferred text editor (TextEdit, VS Code, etc.) and add:ReplaceOPENROUTER_API_KEY=your_deepseek_key
your_deepseek_keywith your actual key. - Save the file.
To start the chat interface, run:
python gpt.py- You will see a welcome message.
- Type your messages and press Enter to chat with the AI.
- To exit, type
exitorquit.
To run the shell command assistant, execute:
python exe.py- Enter your request in plain English (e.g., "Create a folder called myproject and navigate into it").
- The assistant will generate complete shell commands, display them, and ask for your confirmation before executing.
- Review the output and follow the prompts.
TerminalGPT/
├── gpt.py # TerminalGPT chatbot application
├── exe.py # AI Shell Assistant application
├── requirements.txt # Python dependenciesV
├── .env # Environment file with OPENROUTER_API_KEY (not committed)
└── README.md # This documentation file
This project is open-source and available for modification and distribution. See the LICENSE file for details.