An open API service indexing awesome lists of open source software.

https://github.com/simonpierreboucher02/gpt41-cli-agent

A professional, unified Python interface for interacting with multiple OpenAI models including GPT-4.1, GPT-4.1-mini, and GPT-4.1-nano
https://github.com/simonpierreboucher02/gpt41-cli-agent

agent-ai cli gpt-41 gpt-41-mini gpt-41-nano openai

Last synced: about 1 month ago
JSON representation

A professional, unified Python interface for interacting with multiple OpenAI models including GPT-4.1, GPT-4.1-mini, and GPT-4.1-nano

Awesome Lists containing this project

README

          

# πŸ€– OpenAI GPT-4.1 Unified Agent System

**πŸ‘¨β€πŸ’» Author: Simon-Pierre Boucher**

![Python](https://img.shields.io/badge/Python-3.10%2B-blue?logo=python&logoColor=white)
![OpenAI](https://img.shields.io/badge/OpenAI-API-green?logo=openai&logoColor=white)
![License](https://img.shields.io/badge/License-MIT-yellow)
![Version](https://img.shields.io/badge/Version-1.0.0-purple)

**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](#-features) β€’ [βš™οΈ Installation](#-installation) β€’ [πŸš€ Quick Start](#-quick-start) β€’ [πŸ’¬ Chat Commands](#-chat-commands) β€’ [πŸ“Š Usage Examples](#-usage-examples) β€’ [πŸ—οΈ Architecture](#-architecture) β€’ [πŸ”§ Advanced Usage](#-advanced-usage) β€’ [πŸ”’ Security](#-security) β€’ [πŸ› Troubleshooting](#-troubleshooting) β€’ [πŸ“„ License](#-license) β€’ [🀝 Contributing](#-contributing)

---

## ✨ Features

- πŸ”Ή **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**

---

## βš™οΈ Installation

Clone the repository:
```bash
git clone https://github.com/simonpierreboucher02/gpt41-cli-agent.git
cd gpt41-cli-agent
```

Create and activate a virtual environment (recommended):
```bash
python -m venv venv
source venv/bin/activate
```

Install dependencies:
```bash
pip install -r requirements.txt
```

Set your OpenAI API key:
```bash
export OPENAI_API_KEY=your_api_key_here
```

---

## πŸš€ Quick Start

### Create your first agent
```bash
python main.py --create
```

### Start chatting
```bash
python main.py --agent-id my-agent
```

### Use a specific model
```bash
python main.py --agent-id my-agent --model gpt-4.1-mini
```

### List all agents
```bash
python main.py --list
```

### Show available models
```bash
python main.py --models
```

### Export a conversation
```bash
python main.py --agent-id my-agent --export html
```

---

## πŸ’¬ Chat Commands

| Command | Description |
|---------|-------------|
| `help` | Show all commands |
| `history [n]` | Show last n messages |
| `search ` | Search conversation history |
| `stats` | Show statistics |
| `config` | Show current configuration |
| `export ` | Export chat (json/txt/md/html) |
| `clear` | Clear history |
| `files` | List files |
| `model` | Show current model |
| `switch ` | Switch to another model |
| `quit` | Exit chat |

---

## πŸ“Š Usage Examples

- πŸ§‘β€πŸ’» Basic:
```bash
python main.py --agent-id coding --model gpt-4.1
```

- πŸ“ File inclusion:
```
You: Please review {app.py}
Assistant: Reviewing app.py...
```

- πŸ“€ Export:
```bash
python main.py --agent-id my-agent --export html
python main.py --agent-id my-agent --export json
```

- βš™οΈ Config:
```bash
python main.py --agent-id my-agent --config
python main.py --agent-id my-agent --temperature 0.7
```

---

## πŸ—οΈ Architecture

```
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/
```

---

## πŸ”§ Advanced Usage

- πŸ”‘ Environment vars: `OPENAI_API_KEY=...`
- βš™οΈ Options: temperature, max tokens, system prompt, streaming
- 🐞 Error handling: retries, logs

---

## πŸ”’ Security

- πŸ”‘ Secure key storage
- 🚫 Sensitive data excluded from logs/exports
- βœ… Auto `.gitignore` support

---

## πŸ› Troubleshooting

- ❌ Import errors β†’ `pip install -r requirements.txt`
- πŸ”‘ API key errors β†’ `export OPENAI_API_KEY=...`
- πŸ” Permission errors β†’ check directories

---

## πŸ“„ License

MIT License β€” professional & educational use.

---

## 🀝 Contributing

Contributions welcome!

---

**2025-08-29**
*UniversitΓ© Laval*