A simple command-line interface (CLI) for interacting with OpenAI's ChatGPT model.
Before you begin, ensure you have met the following requirements:
- You have a Linux or macOS machine.
- You have installed
curl
,jq
, andglow
.curl
is used for making API requests.jq
is used for parsing JSON responses.glow
is used for rendering markdown content in the terminal.
To use the ChatGPT CLI, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/chatgpt-cli.git
-
Navigate to the cloned directory:
cd chatgpt-cli
-
Make the script executable:
chmod +x chatgpt.sh
-
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY='your-api-key'
To start a chat session with ChatGPT, run the script:
./chatgpt.sh
You can specify the model to use with the -m option:
./chatgpt.sh -m gpt-3.5-turbo
Type your message and press Enter to send it. The response from ChatGPT will be displayed with the prefix ChatGPT:.
To exit the chat, type exit
and press Enter.
Contributions are welcome! If you have a suggestion or improvement, please fork the repository and create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.