chatGPT-shell-cli  by 0xacx

Shell script for OpenAI's ChatGPT/DALL-E via terminal

created 2 years ago
1,228 stars

Top 32.7% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a lightweight shell script to interact with OpenAI's ChatGPT and DALL-E APIs directly from the terminal. It's designed for users who prefer command-line interfaces and want to leverage powerful AI models without setting up complex Python or Node.js environments. The script offers features like chat history, context awareness, image generation, and command execution suggestions.

How It Works

The script utilizes curl for making HTTP requests to OpenAI's API endpoints (/chat/completions and /images/generations) and jq for parsing JSON responses. It supports various OpenAI models, including gpt-3.5-turbo and gpt-4, and allows customization of API parameters like temperature and max tokens. A key feature is its built-in chat context management for models that don't natively support conversation history, ensuring continuity in dialogues.

Quick Start & Requirements

  • Install: curl -sS https://raw.githubusercontent.com/0xacx/chatGPT-shell-cli/main/install.sh | sudo -E bash (or install via AUR: paru -S chatgpt-shell-cli).
  • Prerequisites: curl, jq. An OpenAI API key is required. Optionally, glow for markdown rendering and imgcat (for iTerm) for in-terminal image viewing.
  • Setup: Requires setting the OPENAI_KEY environment variable.
  • Docs: https://github.com/0xacx/chatGPT-shell-cli

Highlighted Details

  • Supports direct terminal image generation and viewing (with imgcat).
  • Can generate and suggest shell commands based on natural language prompts.
  • Allows setting custom initial prompts for "in-character" AI responses.
  • Supports piping input and using script parameters for prompts.

Maintenance & Community

The project has an active Discord server for contributions and support. Several contributors are listed, indicating community involvement.

Licensing & Compatibility

The README does not explicitly state a license. Compatibility for commercial use or closed-source linking is not specified.

Limitations & Caveats

The script relies on external tools (curl, jq) and requires an OpenAI API key, which may incur costs. Image viewing in the terminal is dependent on specific terminal emulators like iTerm.

Health Check
Last commit

1 year ago

Responsiveness

1 day

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

Explore Similar Projects

Feedback? Help us improve.