/GPT-CLI

An interactive CLI for GPT models

Primary LanguagePythonMIT LicenseMIT

GPT-CLI

An interactive CLI for GPT models

Click below to see a short demo!

asciicast

Features

  • Simple and intuitive command-line interface
  • Supports Markdown with syntax-highlighting for code
  • Work with all OpenAI GPT models
  • Customize system message
  • Supports clipboard operations
  • Play sounds on response
  • Model switching on the fly
  • Chat commands to manage the chat and settings
  • Save and Restore chat conversations

Installation

Make sure you have Python 3.10 or higher installed on your system. You can check your Python version by running python --version or python3 --version in your terminal. Older version may work but have not been tested.

  1. Clone the repository:
git clone https://github.com/piercecohen1/GPT-CLI.git
cd GPT-CLI
  1. Create a virtual environment and activate it (optional):
python3 -m venv gpt-venv
source gpt-venv/bin/activate  # On Windows: gpt-venv\Scripts\activate
  1. Install the required dependencies:
pip3 install -r requirements.txt
  1. Add your OpenAI API key as an environment variable (replace your_api_key with your actual API key):

For Zsh:

echo "export OPENAI_API_KEY=your_api_key" >> ~/.zshrc
source ~/.zshrc

For Bash:

echo "export OPENAI_API_KEY=your_api_key" >> ~/.bashrc
source ~/.bashrc

Or, to set temporarily:

export OPENAI_API_KEY=your_api_key  # On Windows: set OPENAI_API_KEY=your_api_key

Alternatively, you can uncomment and replace the "YOUR_API_KEY" placeholder in the code with your actual API key.

Usage

Run the chat application:

python3 chat.py

Enter your message and press enter to send it. The AI model will respond accordingly. To use the available commands, type a / followed by the command.

Available commands:

/paste                    Your clipboard contents will be substituted for the `/paste`

/copy                     Copy the last response to the clipboard

/new                      Start a new chat

/clear                    Clear terminal window

/system [SYSTEM PROMPT]   Start a new chat with a custom system message

/model [MODEL]            Switch models and reset the chat

/quit                     Quit the interactive chat

/info                     Display current model and messages

/save [FILENAME]          Save the chat to a file

/load [FILENAME]          Load a chat from a file

/help                     Display help menu

Examples

Customize system messages to "jailbreak" models

asciicast

Paste easily from the command-line

asciicast

Quickly copy responses

asciicast

License

This project is released under the MIT License.