Go to file
2023-02-08 21:52:26 +02:00
chatgpt.sh Add colors to json response 2023-02-08 21:52:26 +02:00
install.sh Print installation info for troubleshooting, source profiles after install, VScode autoformatting 2023-01-26 14:21:04 +02:00
LICENSE Create LICENSE 2023-01-12 14:33:32 +02:00
README.md Update README.md 2023-01-27 13:00:07 +02:00

shell

chatGPT-shell-cli

A simple, lightweight shell script to use OpenAI's chatGPT and DALL-E from the terminal without installing python or node.js. The script uses the completions endpoint and the text-davinci-003 model for chatGPT and the images/generations endpoint for generating images.

Features

  • Chat with GPT from the terminal
  • Generate images from a text prompt
  • View your chat history

Screenshot 2023-01-12 at 13 59 08

Screenshot 2023-01-13 at 16 39 27

Getting Started

Prerequisites

This script relies on curl for the requests to the api and jq to parse the json response.

  • curl
    brew install curl
    
  • jq
    brew install jq
    
  • An OpenAI API key. Create an account and get a free API Key at OpenAI

Installation

To install, run this in your terminal and provide your OpenAI API key when asked.

curl -sS https://raw.githubusercontent.com/0xacx/chatGPT-shell-cli/main/install.sh | sudo -E bash

Manual Installation

If want to install it manually, all you have to do is:

  • Download the chatgpt.sh file in a directory you want
  • Add the path of chatgpt.sh to your $PATH. You do that by adding this line to your shell profile: export PATH=$PATH:/path/to/chatgpt.sh
  • Add the OpenAI API key to your shell profile by adding this line export OPENAI_KEY=your_key_here
  • If you are using iTerm and want to view images in terminal, install imgcat

Usage

  • Run the script by using the chatgpt command anywhere
  • To generate images, start a prompt with image: If you are using iTerm, you can view the image directly in the terminal. Otherwise the script will ask to open the image in your browser.
  • To view your chat history, type history