A simple, lightweight CLI to use OpenAI's ChatGPT and DALL-E from the terminal.
Project description
original work
https://github.com/0xacx/chatGPT-shell-cli
GPT-shell-4o-mini
A simple, lightweight Python CLI to use OpenAI's ChatGPT and DALL-E from the terminal.
Features ✨
🌍 Cross-Platform Support
- Windows 10/11 - Full support with automatic environment variable setup
- macOS - Works seamlessly on all versions
- Linux - Supports all major distributions (Ubuntu, Fedora, Debian, Arch, etc.)
🧠 Smart Terminal Context
- User Profile - Remembers your OS, username, and distribution
- Terminal Session Info - Sends current working directory, shell type, and environment to ChatGPT
- Intelligent Responses - ChatGPT sees your context and environment for better assistance
🚀 Easy Setup
- First-run wizard - Automatic API key setup and verification
- Python Package - Installable via pip for easy management
- Cross-platform - Works on Windows, macOS, and Linux
Getting Started
Prerequisites
- Python 3.7+ (usually pre-installed)
- An OpenAI API key - Get one free at OpenAI
Installation
Installation
Pip Installation (Recommended for all platforms):
pip install gpt-shell-4o-mini
After installation, run gpt to start the setup wizard:
gpt
The wizard will:
- Prompt for your OpenAI API key
- Verify the key with OpenAI
- Save it securely in your os environment
- Create your user profile
- Files Will be created at your home directory as chatgpt_py**
Uninstallation
IMPORTANT: Command Order Matters
Always run gpt-remove BEFORE pip uninstall - the gpt-remove command is part of the package and will be removed by pip uninstall.
Method 1: Complete Uninstall (Recommended)
gpt-remove
What gpt-remove does:
- Interactive confirmation - asks before proceeding
- Removes configuration files - deletes
~/.chatgpt_py_*files - Cleans environment variables - removes OPENAI_KEY from shell profiles
- Uninstalls Python package - runs
pip uninstall gpt-shell-4o-miniautomatically - Shows progress - detailed feedback throughout the process
Result: Complete removal of all traces of the package
Method 2: Basic Package Removal
pip uninstall gpt-shell-4o-mini
What pip uninstall does:
- Removes Python package - deletes package from site-packages
- Removes commands - deletes
gpt,chatgpt, andgpt-removecommands - Leaves configuration files -
~/.chatgpt_py_*files remain - Leaves environment variables - OPENAI_KEY in shell profiles remains
Result: Package removed but manual cleanup required
Method 3: Manual Cleanup After Basic Uninstall
If you already ran pip uninstall and need to clean up:
# Download and run the uninstall module
curl -O https://raw.githubusercontent.com/wkdkavishka/GPT-shell-4o-mini/main/chatgpt/uninstall.py
python uninstall.py
What this does:
- Removes configuration files - cleans up
~/.chatgpt_py_*files - Cleans environment variables - removes OPENAI_KEY from shell profiles
- Cannot uninstall package - package already removed
Result: Configuration cleanup only
Manual Cleanup Required After pip uninstall
If you used pip uninstall without gpt-remove, manually remove:
- Chat history:
~/.chatgpt_py_history - Custom system prompt:
~/.chatgpt_py_sys_prompt - User profile:
~/.chatgpt_py_info - Environment variables: OPENAI_KEY from shell profiles (
~/.bashrc,~/.zshrc, etc.)
Usage
Command Line Options
gpt [OPTIONS]
Basic Options
-h, --help- Show help message and exit-p, --prompt PROMPT- Provide prompt directly instead of starting chat--prompt-from-file FILE- Provide prompt from a file-l, --list- List available OpenAI models
Model & Response Options
-m, --model MODEL- Model to use (default: gpt-4o-mini)-t, --temperature TEMPERATURE- Sampling temperature (default: 0.7)--max-tokens MAX_TOKENS- Max tokens for completion (default: 1024)-s, --size SIZE- Image size for DALL-E (default: 512x512)
System Prompt Management
-i, --init-prompt PROMPT- Provide initial system prompt (overrides default)--init-prompt-from-file FILE- Provide initial system prompt from file--sys-prompt PROMPT- Set or update custom system prompt (saved to ~/.chatgpt_py_sys_prompt)--get-sys-prompt- Show current custom system prompt--reset-sys-prompt- Remove custom system prompt and use default
Debug Options
--debug- Print debug information including context sent to AI
Usage Examples
Interactive Chat Mode
gpt
# Starts interactive chat with ChatGPT
Single Prompt Mode
gpt -p "What is the regex to match an email address?"
gpt --prompt "Translate to French: Hello World!"
Pipe Mode
echo "What is the command to get all pdf files created yesterday?" | gpt
ls -la | gpt -p "Explain these file permissions"
File Input
gpt --prompt-from-file my_prompt.txt
gpt --init-prompt-from-file custom_system_prompt.txt
Model Configuration
gpt --model gpt-4 --temperature 0.9 --max-tokens 2000
gpt -m gpt-4o -t 0.5
System Prompt Management
# Set custom system prompt
gpt --sys-prompt "You are a helpful Python programmer. Always provide code examples."
# View current system prompt
gpt --get-sys-prompt
# Reset to default
gpt --reset-sys-prompt
# Use temporary system prompt
gpt -i "You are a chef. Provide cooking advice." -p "How do I make pasta?"
Debug Mode
gpt --debug -p "Why is my script not working?"
gpt --debug # Starts interactive chat with debug info
🧠 Terminal Context Feature
How It Works
GPT-shell-4o-mini automatically sends contextual information with every prompt:
User Profile (~/.chatgpt_py_info):
- Your username
- Operating system and version
- Linux distribution (if applicable)
Terminal Session (captured in real-time):
- Current working directory
- Shell type (bash, zsh, PowerShell, etc.)
- Environment information
Example
When you run gpt, ChatGPT sees:
[Static Profile: User: john | OS: Linux | Distro: Ubuntu 22.04]
[Terminal Session (Shell: bash | CWD: /home/john/project):
]
You: How do I fix this Python error?
ChatGPT response will be context-aware:
"I see you're working in the
/home/john/projectdirectory on Ubuntu..."
Debug Mode
Use --debug to see exactly what context is sent to ChatGPT:
gpt --debug -p "Help me debug this issue"
This will show:
- The full user profile
- Terminal session information
- Complete message history being sent
- Model parameters being used
Support
For issues, questions, or contributions, please visit the
GitHub Repository
Interactive Commands
During interactive chat mode, you can use these special commands:
image:Generate images - Start a prompt withimage:followed by description- Example:
image: a cute cat sitting on a laptop
- Example:
historyView your chat historymodelsList available OpenAI modelsmodel:Get details on a specific model - Start withmodel:followed by model ID- Example:
model: gpt-4o-mini
- Example:
command:Generate and execute commands - Start withcommand:followed by description- Example:
command: list all files larger than 100MB in current directory
- Example:
exit,quit,qExit the chat
Image Generation
# In interactive mode
image: a beautiful sunset over mountains
# With specific size
gpt -s "1024x1024" -p "image: futuristic cityscape"
Available image sizes: 256x256, 512x512, 1024x1024, 1792x1024, 1024x1792, 2048x2048, 4096x4096
Command Generation
# In interactive mode
command: find all Python files with syntax errors
# As single prompt
gpt -p "command: compress all log files older than 30 days"
⚠️ Safety Warning: Generated commands are checked for dangerous patterns. You'll be asked to confirm before execution.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gpt_shell_4o_mini-1.2.2.tar.gz.
File metadata
- Download URL: gpt_shell_4o_mini-1.2.2.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e463085130562be60d1a6de4c03b17a68ea430a69623b8169d3371d4bc3a8fc2
|
|
| MD5 |
488f23a766834758fc3483a7d515ebb4
|
|
| BLAKE2b-256 |
b95f9301607c2bc0ae1f2a530c3b017eba26134804bd4e15deb089ad74446f3f
|
File details
Details for the file gpt_shell_4o_mini-1.2.2-py3-none-any.whl.
File metadata
- Download URL: gpt_shell_4o_mini-1.2.2-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da847375e2c2d4c1369104ff2618010654c71ba0ffcdc22c69dcebca646777a1
|
|
| MD5 |
1999221e70ec6beda25768434f3c0f1c
|
|
| BLAKE2b-256 |
e42101ffeab4abadb5a6ced0fe52df146050d46758a0f188bc0db2f55d3effb3
|