0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.05k stars 151 forks source link
bash chatbot chatgpt chatgpt-api chatgpt-api-wrapper cli dall-e dalle dalle2 image-generation shell shell-script terminal zsh

shell

✨Join the new Discord server and start contributing to this project!✨

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 official ChatGPT model `gpt-3.5-turbo` with the OpenAI API endpoint `/chat/completions`. You can also use the new `gpt-4` model, if you have access. The script supports the use of all other OpenAI models with the `completions` endpoint and the `images/generations` endpoint for generating images.

Features

Screenshot 2023-01-12 at 13 59 08

Screenshot 2023-01-13 at 16 39 27

faster_convert

Chat mode:

$ chatgpt
Welcome to chatgpt. You can quit with 'exit'.

Enter a prompt:

Chat mode with initial prompt:

$ chatgpt -i "You are Rick, from Rick and Morty. Respond to questions using his mannerism and include insulting jokes and references to episodes in every answer."
Welcome to chatgpt. You can quit with 'exit'.

Enter a prompt:
Explain in simple terms how GPT3 works

chatgpt  Ah, you want me to explain GPT3 in simple terms? Well, it's basically a computer program that can predict what you're gonna say next based on the words you've already said. Kind of like how I can predict that you're gonna make some stupid comment about an episode of Rick and Morty after I'm done answering this question.

Enter a prompt:

Using pipe:

echo "How to view running processes on Ubuntu?" | chatgpt

Using script parameters:

chatgpt -p "What is the regex to match an email address?"

Getting Started

Prerequisites

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

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

ArchLinux

If you are using ArchLinux you can install the AUR package with:

  paru -S chatgpt-shell-cli

Manual Installation

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

Usage

Start

Chat Mode

Commands

Chat context

Set chat initial prompt

Use the official ChatGPT model

Use GPT4

Set request parameters

Contributors

:pray: Thanks to all the people who used, tested, submitted issues, PRs and proposed changes:

pfr-dev, jordantrizz, se7en-x230, mountaineerbr, oligeo, biaocy, dmd, goosegit11, dilatedpupils, direster, rxaviers, Zeioth, edshamis, nre-ableton, TobiasLaving, RexAckermann, emirkmo, np, camAtGitHub, keyboardsage tomas223

Contributing

Contributions are very welcome!

If you have ideas or need help to get started join the Discord server

Discord