Skip to main content

Command line interface tool for interacting with ChatGPT using terminal

Project description

ChatGPT - Command Line Interface

CLI tool for interacting with ChatGPT using terminal

Requirements

  • Python >= 3.8.0
  • OpenAI account and valid API key

Installation

Tool can be installed using python3 pip command:

pip install chatgpt-cli-tool

Or you can install it directly form this project after building it:

python build.py

pip install dist/chatgpt-cli-tool-{version}.tar.gz

Configuration

In order to use ChatGPT cli you will first need to register and create an API key on the official OpenAI website.

Then you can configure the tool with your API key using any of the following options:

  1. Create an ~/.chatgpt-cli/.env file with variable OPENAI_API_KEY
  2. Create an .env file in the working directory with variable OPENAI_API_KEY
  3. Set it through environment variable OPENAI_API_KEY
  4. Pass it as the first argument when executing this tool (e.g. chatgpt-cli my_api_key)

To see other configurable options for ChatGPT check out .env.example file.

Running the CLI

If you installed the tool using pip, then simply start the cli using any of the following commands:

# interactive chat command template
chatgpt-cli [api_key]

# example with api key
chatgpt-cli my_api_key

# example without api key
chatgpt-cli
# single gpt request command template
gpt-ai [api_key] [query]

# single command example with api key and query argument
gpt-ai my_api_key "What is ChatGPT?"

# single command example with query argument
gpt-ai "What is ChatGPT?"

# single command example with query from stdin
cat question.txt | gpt-ai

# single command example with both query as argument and piped input
cat long-story.txt | gpt-ai "sumarize this text in 5 bullet points"

# single command example with both query as argument and input directly from file
gpt-ai "explain this code" < main.py

API key argument is optional, but if provided it will override API key defined using environment variables.

License

ChatGPT-cli is MIT licensed.

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

chatgpt-cli-tool-1.2.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

chatgpt_cli_tool-1.2.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file chatgpt-cli-tool-1.2.3.tar.gz.

File metadata

  • Download URL: chatgpt-cli-tool-1.2.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.2

File hashes

Hashes for chatgpt-cli-tool-1.2.3.tar.gz
Algorithm Hash digest
SHA256 ff94b202e52d22cf34ebd7a875ca1eb69586eb6c9b8c1c97639b7084461228f1
MD5 d94cae165f3460c2b9b8f430f3e5cac0
BLAKE2b-256 08dff612b6414de3a227c560c613ebcdacce69a10b75e43164da509625433feb

See more details on using hashes here.

File details

Details for the file chatgpt_cli_tool-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: chatgpt_cli_tool-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.2

File hashes

Hashes for chatgpt_cli_tool-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 efb247b9a18bb067a847be1eee395b6f7b25ef6b4aa8e5217d8238e541326d78
MD5 9c27fb3c4cb39a3f47875610e71ac5d6
BLAKE2b-256 62ada69c694dff20710ba88f791d5d9faa09a6c32074b805f8da4d89af21724d

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