Skip to main content

ChatGPT CLI Tool

PyPI Python License Tests

A flexible, full-featured command-line tool for interacting with OpenAI's ChatGPT API.

🔧 Features

  • Prompt input from command line
  • Configurable model and system prompt
  • Conversation sessions with persistent context
  • Export sessions to text or Markdown (with YAML front matter)
  • Logging and log filtering
  • Colorized output (optional)
  • Packaged as a command-line tool (chatgpt-cli)

🚀 Installation

pip install .

🛠 Usage Examples

# Basic prompt
chatgpt-cli --prompt "What is bourbon?"

# Start a named session
chatgpt-cli --prompt "Explain Terraform." --session devops.json

# Export session to Markdown
chatgpt-cli --session devops.json --export-session devops.md

# Use a specific model and system prompt
chatgpt-cli --prompt "What's new in Python 3.12?" \
  --model gpt-4 \
  --system "You are a Python expert."

📄 Configuration

Set your OpenAI API key in a .env file or your environment:

OPENAI_API_KEY=sk-...

📦 Project Structure

chatgpt_cli/
├── __main__.py
├── pyproject.toml
├── README.md
└── requirements.txt

🔗 Links

🧾 License

MIT License

Metadata

Release files for chatcli-gptx 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chatcli-gptx 1.0.1
File Size Uploaded
chatcli_gptx-1.0.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chatcli-gptx 1.0.1
File Interpreter ABI Platform
chatcli_gptx-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / chatcli_gptx-1.0.1.tar.gz

Download URL chatcli_gptx-1.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3be467f5281e45d991ffd73e899c6411c153a67658e60777a9a2c6e29f550498
BLAKE2b-256 checksum
How to use checksums
d855f1f72a8173c71916d63f85d726ab3f26c90ace13cc6f750f7f02e52630c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Release files / chatcli_gptx-1.0.1-py3-none-any.whl

Download URL chatcli_gptx-1.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd428eebb473c70b57c8dc8504c332f0300e1c930324ad46de9129cd4dff43a9
BLAKE2b-256 checksum
How to use checksums
09c65de30a9fe41bc5679ca3fec211b2ef59ceb63a977f0a5bf445af09f99d56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.17

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page