Skip to main content

A flexible command-line tool for interacting with OpenAI's ChatGPT API

Project description

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

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

chatcli_gptx-1.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatcli_gptx-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file chatcli_gptx-1.0.1.tar.gz.

File metadata

  • Download URL: chatcli_gptx-1.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for chatcli_gptx-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3be467f5281e45d991ffd73e899c6411c153a67658e60777a9a2c6e29f550498
MD5 47b4767836c3b0996757aca6c2a6db2b
BLAKE2b-256 d855f1f72a8173c71916d63f85d726ab3f26c90ace13cc6f750f7f02e52630c9

See more details on using hashes here.

File details

Details for the file chatcli_gptx-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: chatcli_gptx-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for chatcli_gptx-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd428eebb473c70b57c8dc8504c332f0300e1c930324ad46de9129cd4dff43a9
MD5 57783ab5ccf98513cd4a8279878b2030
BLAKE2b-256 09c65de30a9fe41bc5679ca3fec211b2ef59ceb63a977f0a5bf445af09f99d56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page