👨💻 Author: Simon-Pierre Boucher
A professional, unified Python CLI agent for OpenAI GPT-4.1 models
Supports GPT-4.1, GPT-4.1 Mini, and GPT-4.1 Nano with advanced conversation management and exports
✨ Features • ⚙️ Installation • 🚀 Quick Start • 💬 Chat Commands • 📊 Usage Examples • 🏗️ Architecture • 🔧 Advanced Usage • 🔒 Security • 🐛 Troubleshooting • 📄 License • 🤝 Contributing
- 🔹 All GPT-4.1 Models: GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano
- 🎨 Beautiful CLI: Colorful interface, intuitive commands
- 📁 File Inclusion:
{filename}
syntax - 📤 Multi-format Export: JSON, TXT, Markdown, HTML
- 💬 Persistent History: Storage with search & backup
- ⚙️ Interactive Configuration
- 🛡️ Error Handling & Logging
Clone the repository:
git clone https://github.com/simonpierreboucher02/gpt41-cli-agent.git
cd gpt41-cli-agent
Create and activate a virtual environment (recommended):
python -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Set your OpenAI API key:
export OPENAI_API_KEY=your_api_key_here
python main.py --create
python main.py --agent-id my-agent
python main.py --agent-id my-agent --model gpt-4.1-mini
python main.py --list
python main.py --models
python main.py --agent-id my-agent --export html
Command | Description |
---|---|
help |
Show all commands |
history [n] |
Show last n messages |
search <term> |
Search conversation history |
stats |
Show statistics |
config |
Show current configuration |
export <format> |
Export chat (json/txt/md/html) |
clear |
Clear history |
files |
List files |
model |
Show current model |
switch <model> |
Switch to another model |
quit |
Exit chat |
-
🧑💻 Basic:
python main.py --agent-id coding --model gpt-4.1
-
📁 File inclusion:
You: Please review {app.py} Assistant: Reviewing app.py...
-
📤 Export:
python main.py --agent-id my-agent --export html python main.py --agent-id my-agent --export json
-
⚙️ Config:
python main.py --agent-id my-agent --config python main.py --agent-id my-agent --temperature 0.7
gpt41-cli-agent/
├── main.py
├── agent.py
├── config.py
├── utils.py
├── export.py
├── requirements.txt
└── agents/
└── {agent-id}/
├── config.yaml
├── history.json
├── secrets.json
├── backups/
├── logs/
└── exports/
- 🔑 Environment vars:
OPENAI_API_KEY=...
- ⚙️ Options: temperature, max tokens, system prompt, streaming
- 🐞 Error handling: retries, logs
- 🔑 Secure key storage
- 🚫 Sensitive data excluded from logs/exports
- ✅ Auto
.gitignore
support
- ❌ Import errors →
pip install -r requirements.txt
- 🔑 API key errors →
export OPENAI_API_KEY=...
- 🔐 Permission errors → check directories
MIT License — professional & educational use.
Contributions welcome!
2025-08-29
Université Laval