chatgpt-cli  by marcolardera

CLI tool for interacting with ChatGPT via the official API

created 2 years ago
472 stars

Top 65.5% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a command-line interface (CLI) for interacting with OpenAI's ChatGPT API. It's designed for developers and power users who want to leverage ChatGPT's capabilities directly from their terminal, offering cost-effectiveness and speed compared to web interfaces, with features for managing conversations, context, and output formatting.

How It Works

The CLI utilizes Python and the official OpenAI API. Users authenticate via an API key, which can be provided through a configuration file (config.yaml), environment variables, or command-line arguments. It supports various ChatGPT models, including different versions of GPT-3.5 and GPT-4, allowing users to select models based on performance and cost. The tool handles conversation history, context management via file input, and renders Markdown responses with syntax highlighting.

Quick Start & Requirements

  • Install: pip install git+https://github.com/marcolardera/chatgpt-cli
  • Prerequisites: Python 3.10+, Pip, Git. An OpenAI API key is required.
  • Configuration: API key can be set in config.yaml, via OPENAI_API_KEY environment variable, or with the -k / --key flag.
  • Usage: Run chatgpt-cli to start an interactive session.
  • Docs: https://github.com/marcolardera/chatgpt-cli

Highlighted Details

  • Supports multiple OpenAI models with pricing information provided.
  • Features include multi-line input (-ml), context from files (-c), session restoration (-r), and non-interactive piping (-n).
  • Markdown rendering with syntax highlighting and table support.
  • JSON output mode available for specific models (-j).
  • Can be integrated with other CLIs, like DALL-E CLI, via piping.

Maintenance & Community

The project was last updated on February 16, 2024. Information on community channels or specific maintainers is not detailed in the README.

Licensing & Compatibility

The project's license is not explicitly stated in the README. Compatibility for commercial use or closed-source linking would require clarification.

Limitations & Caveats

The JSON mode feature is currently limited to gpt-3.5-turbo-0125 and gpt-4-turbo-preview models. The README notes that some user accounts may require advance credit balance charging to use OpenAI APIs.

Health Check
Last commit

1 week ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
5 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.