chatGPT-shell-cli
FreeUse ChatGPT from the command-line. Shell script.
FreeFree tier
Inputs: textOutputs: text, image
About chatGPT-shell-cli
chatGPT-shell-cli is a lightweight, open-source shell script that enables direct interaction with OpenAI's ChatGPT (gpt-3.5-turbo) and DALL-E image generation from the terminal, without requiring Python or Node.js. It supports multiple input modes—interactive chat, pipe, and script parameters—and maintains chat context for coherent conversations. Users can list available models, set custom API parameters, and even generate and execute shell commands. The script is easily installed via a single curl command and relies only on curl and jq.
Key Features
Chat with official ChatGPT API (gpt-3.5-turbo, with gpt-4 support if available)
Generate images from text prompts via DALL-E
View and maintain chat history with context awareness
Support for multiple input modes: interactive chat, pipe, and script parameters
List all available OpenAI models
Set custom OpenAI request parameters (temperature, max_tokens, etc.)
Generate and execute shell commands from natural language
Role-play or set initial prompt for customized interactions
Lightweight: no Python or Node.js dependencies, only curl and jq
Pros & Cons
Pros
- Extremely lightweight: no Python or Node.js required, only curl and jq
- Easy installation via a single curl command (or AUR package for ArchLinux)
- Supports multiple interaction modes (interactive, pipe, parameter) for flexibility
- Maintains chat context so the AI remembers previous messages
- Free and open source (MIT license) with no subscription cost—just need an OpenAI API key
- Supports image generation from DALL-E in addition to text chat
- Can generate and run shell commands automatically
Cons
- Requires an OpenAI API key, which has usage costs after the free tier
- Relies on external dependencies curl and jq (must be installed separately)
- No streaming or real-time response; waits for full completion
- Command-line only—no graphical interface
- Context window limited by the underlying model (e.g., 4096 tokens for gpt-3.5-turbo)
- Not suitable for complex long-running conversations due to context limits
Best For
Getting quick programming or command-line answers directly in the terminalGenerating shell commands based on natural language descriptionsCreating images from text descriptions without leaving the terminalRole-playing conversations with custom personas (e.g., Rick from Rick and Morty)Automating queries in scripts or pipelines via pipe or parameterExploring and testing different OpenAI models and parameters
FAQ
How do I install chatGPT-shell-cli?
Run the following command in your terminal and provide your OpenAI API key when prompted: curl -sS https://raw.githubusercontent.com/0xacx/chatGPT-shell-cli/main/install.sh | sudo -E bash. Alternatively, ArchLinux users can install the AUR package 'chatgpt-shell-cli' via paru or yay.
What OpenAI models does it support?
By default, it uses gpt-3.5-turbo via the /chat/completions endpoint. If you have access, you can also use gpt-4. Additionally, it supports all other OpenAI models via the completions endpoint and the images/generations endpoint for DALL-E.
Does it support image generation?
Yes, it supports generating images from text prompts using OpenAI's DALL-E models via the images/generations endpoint.
Can I use it in scripts or with pipes?
Yes. You can pass input via pipe (e.g., echo 'How to list files?' | chatgpt) or as a script parameter (e.g., chatgpt -p 'What is the regex for email?'). It also supports an interactive chat mode.
What are the prerequisites?
You need curl and jq installed on your system, and an OpenAI API key (get one free at platform.openai.com). Optionally, you can install glow for rendering Markdown responses and imgcat (for iTerm) to view images in terminal.