← Open Source
0xacx

chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.

ApplicationsWrappersShell
Open on GitHub
Momentum
+0stars in 24 hours0.0%
1.24k
Stars
163
Forks
+1
This week
14
Contributors
Created 2022-12-14 · Updated 2026-10-15 · #11002 today
Top developers
0xacxcamAtGitHubnp

0xacx/chatGPT-shell-cli is ranked 11,002 with 1,241 stars.

Same-category comparison

0xacx/chatGPT-shell-cli is ranked 11,002 among these 8 peers; otaha178/Emotion-recognition is ranked 10,999.

Same-category comparison
NameRankMetrics
florestefano1975/comfyui-portrait-master10,986
Language:
Python
Stars:
1,245
Forks:
218
Description:
This node was designed to help AI image creators to generate prompts for human portraits.
pnd280/complexity10,988
Language:
TypeScript
Stars:
1,245
Forks:
119
Description:
⚡ Supercharge your favourite AI Chat web apps. Currently supports Perplexity AI.
gitmylo/audio-webui10,989
Language:
Python
Stars:
1,244
Forks:
112
Description:
A webui for different audio related Neural Networks.
otaha178/Emotion-recognition10,999
Language:
Python
Stars:
1,242
Forks:
371
Description:
Real time emotion recognition.
GML-MMGroup/GMTalker11,009
Language:
Python
Stars:
1,239
Forks:
60
tontinton/maki11,014
Language:
Rust
Stars:
1,239
Forks:
187
Description:
An efficient AI coding agent extendable by neovim-like Lua plugins.
CyberPunkMetalHead/gateio-crypto-trading-bot-binance-announcements-new-coins11,023
Language:
Python
Stars:
1,236
Forks:
291
Description:
This is a crypto trading bot that scans the Binance Annoucements page for new coins, and places trades on Gateio.
lcoutodemos/clui-cc11,039
Language:
TypeScript
Stars:
1,234
Forks:
169
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguageShell
CategoryApplications
SubcategoryWrappers
Stars1,241
Forks163
Contributors14
Created date2022-12-14
Updated date2026-10-15
Stars in 1 day0
Stars in 7 days1
Rank11,002
Previous rank5,858
Rank change-5,144
7-day stars rank10,033
Previous 7-day stars rank10,073
7-day stars rank change40
Total stars rank9,437
Previous total stars rank9,424
Total stars rank change-13
README summary

✨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. The script uses the official ChatGPT model with the OpenAI API endpoint . You can also use the new model, if you have access. The script supports the use of all other OpenAI models with the endpoint and the endpoint for generating images. Features Chat with the

✨ official ChatGPT API ✨ from the terminal Generate images from a text prompt View your chat history Chat context, GPT remembers previous chat questions and answers Pass the input prompt with pipe, as a script parameter or normal chat mode List all available OpenAI models Set OpenAI request parameters Generate a command and run it in terminal Chat mode: Chat mode with initial prompt: Using pipe: Using script parameters: Getting Started Prerequisites This script relies on curl for the requests to

the api and jq to parse the json response. Create an account and get a free API Key at OpenAI Optionally, you can install glow to render responses in markdown Installation To install, run this in your terminal and provide your OpenAI API key when asked. ArchLinux If you are using ArchLinux you can install the AUR package with: Manual Installation If you want to install it manually, all you have to do is: Download the file in a directory

you want Add the path of to your . You do that by adding this line to your shell profile: Add the OpenAI API key to your shell profile by adding this line If you are using iTerm and want to view images in terminal, install imgcat Usage Start Chat Mode Run the script by using the command anywhere. Pipe Mode You can also use it in pipe mode Script Parameters You can also pass the prompt as a command line

argument Commands To generate images, start a prompt with To view your chat history, type To get a list of the models available at OpenAI API, type To view all the information on a specific model, start a prompt with and the model as it appears in the list of models. For example: will get you all the fields for model To get a command with the specified functionality and run it, just type and explain what you want to

achieve. The script will always ask you if you want to execute the command. *If a command modifies your file system or dowloads external files the script will show a warning before executing. * Chat context For models other than and where the chat context is not supported by the OpenAI api, you can use the chat context build in this script. You can enable chat context mode for the model to remember your previous chat questions and answers. This way

you can ask follow-up questions. In chat context the model gets a prompt to act as ChatGPT and is

Frequently asked questions

How many stars and forks are recorded?

0xacx/chatGPT-shell-cli has 1,241 stars and 163 forks.

What is the repository rank?

0xacx/chatGPT-shell-cli is ranked 11,002.

What language and category are recorded?

0xacx/chatGPT-shell-cli has 1,241 stars, uses Shell and belongs to Applications.

Which repository is closest in rank?

0xacx/chatGPT-shell-cli is compared with otaha178/Emotion-recognition, ranked 10,999 with 1,242 stars.

README

✨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

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.

  • curl

    brew install curl
    
  • jq

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

  • Optionally, you can install glow to render responses in markdown

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:

  • 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

Start

Chat Mode

  • Run the script by using the chatgpt command anywhere. By default the script uses the gpt-3.5-turbo model.

Pipe Mode

  • You can also use it in pipe mode echo "What is the command to get all pdf files created yesterday?" | chatgpt

Script Parameters

  • You can also pass the prompt as a command line argument chatgpt -p "What is the regex to match an email address?"

Commands

  • image: 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.
  • history To view your chat history, type history
  • models To get a list of the models available at OpenAI API, type models
  • model: To view all the information on a specific model, start a prompt with model: and the model id as it appears in the list of models. For example: model:text-babbage:001 will get you all the fields for text-babbage:001 model
  • command: To get a command with the specified functionality and run it, just type command: and explain what you want to achieve. The script will always ask you if you want to execute the command. i.e. command: show me all files in this directory that have more than 150 lines of code If a command modifies your file system or dowloads external files the script will show a warning before executing.

Chat context

  • For models other than gpt-3.5-turbo and gpt-4 where the chat context is not supported by the OpenAI api, you can use the chat context build in this script. You can enable chat context mode for the model to remember your previous chat questions and answers. This way you can ask follow-up questions. In chat context the model gets a prompt to act as ChatGPT and is aware of today's date and that it's trained with data up until 2021. To enable this mode start the script with -c or --chat-context. i.e. chatgpt --chat-context and start to chat.

Set chat initial prompt

  • You can set your own initial chat prompt to use in chat context mode. The initial prompt will be sent on every request along with your regular prompt so that the OpenAI model will "stay in character". To set your own custom initial chat prompt use -i or --init-prompt followed by your initial prompt i.e. chatgpt -i "You are Rick from Rick and Morty, reply with references to episodes."
  • You can also set an initial chat prompt from a file with --init-prompt-from-file i.e. chatgpt --init-prompt-from-file myprompt.txt

*When you set an initial prompt you don't need to enable the chat context.

Use the official ChatGPT model

  • The default model used when starting the script is gpt-3.5-turbo.

Use GPT4

  • If you have access to the GPT4 model you can use it by setting the model to gpt-4, i.e. chatgpt --model gpt-4

Set request parameters

  • To set request parameters you can start the script like this: chatgpt --temperature 0.9 --model text-babbage:001 --max-tokens 100 --size 1024x1024

    The available parameters are:

    • temperature, -t or --temperature
    • model, -m or --model
    • max number of tokens, --max-tokens
    • image size, -s or --size (The sizes that are accepted by the OpenAI API are 256x256, 512x512, 1024x1024)
    • prompt, -p or --prompt
    • prompt from a file in your file system, --prompt-from-file

    To learn more about these parameters you can view the API documentation

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

Nearby in the ranking
Similar items