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 string input
cat long-story.txt | gpt-ai "sumarize this text in 5 bullet points"

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.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

chatgpt_cli_tool-1.2.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chatgpt-cli-tool-1.2.0.tar.gz
  • Upload date:
  • Size: 5.0 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.0.tar.gz
Algorithm Hash digest
SHA256 f9f3870361dcd98ceccdefec302a356180ddbbb1b315f90083ab8061fbe891d8
MD5 71e393a60dd02eb5ddc69a0176cde241
BLAKE2b-256 dd1177a2cec5b93bc0a89b883c48afabda32f678915ab436e8ab155a3ffd23a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chatgpt_cli_tool-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39bd6902ebd1ab085247e724d30a852e6811758dd12cbd37221d03b242b34370
MD5 9194160e05c55958a36aac06adae0fa4
BLAKE2b-256 3a9f66319b734b65785b1a9987c1e174a9a392b3664cf8f223a76a990a770459

See more details on using hashes here.

Supported by

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