Chat GPT Shell Cli

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

AI & Machine LearningShellMIT

Abstract

Chat GPT Shell Cli is an open-source AI & Machine Learning project. Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required. Join the new Discord server and start contributing to this project! It is built using Shell. Key capabilities include: Chat with the official ChatGPT API from the terminal; Generate images from a text prompt; View your chat history. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building an AI & Machine Learning mini project or final-year project.

1. Introduction

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

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.

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

2. Objective

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

This project demonstrates how Shell can be applied to a real-world AI & Machine Learning problem.

3. Key Features / Modules

  • 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

4. Technology Stack

Shell

5. System Requirements

General requirements for this technology stack — check the README for exact versions.

  • Linux / macOS terminal or WSL on Windows
  • Git (to clone the repository)

6. Installation & Setup

git clone https://github.com/0xacx/chatGPT-shell-cli.git
cd chatGPT-shell-cli
  1. Download the chatgpt.sh file in a directory you want
  2. 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
  3. Add the OpenAI API key to your shell profile by adding this line export OPENAI_KEY=your_key_here
  4. If you are using iTerm and want to view images in terminal, install imgcat
curl -sS https://raw.githubusercontent.com/0xacx/chatGPT-shell-cli/main/install.sh | sudo -E bash

Full setup instructions are in the project README.

7. Future Enhancements

Suggested extensions you can add to make this your own project.

  • Deploy the model as a web app with Streamlit, Flask or FastAPI
  • Compare against an additional model and report the metric difference
  • Add explainability (SHAP / Grad-CAM)

8. Viva / Review Questions

Common questions examiners ask for projects in this domain.

  1. What dataset does the project use and how was it pre-processed?
  2. Which algorithm / model architecture is used and why was it chosen over alternatives?
  3. How are training and testing data split, and how is overfitting avoided?
  4. Which evaluation metrics (accuracy, precision, recall, F1) are reported and what do they mean here?
  5. How would you deploy this model for real users?

9. Source Code & License

This project is developed by 0xacx and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.

Want to build this as your internship project?

Work on an AI & Machine Learning project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.

Apply for AI & Machine Learning Internship