Skip to main content

GPT-CLI

GPT-CLI is an interactive CLI for communicating with GPT models, with over 30 stars on GitHub.

Loading...

See a short demo below!

Demo 1

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

  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                    Paste clipboard content

/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] Start a new chat with the specified model

/quit Exit the program

/info Display info about the current chat session

/save [FILENAME] Save the chat to a file

/load [FILENAME] Load a chat from a file

/help Display this help message

Examples

Customize system messages to "jailbreak" models

Demo 2

Paste easily from the command-line

Demo 3

Quickly copy responses

Demo 4

License

This project is released under the MIT License.