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.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.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: chatgpt-cli-tool-1.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1533b8ce1ad4f889e4434375a9bac7a8359c1b7cec138749281c1193ee1a8737
MD5 3b3818983cc3bf49d4d73bfacc3f8ee3
BLAKE2b-256 ca44c563589dea528be1be4604f8f16de401d74c0772d51f74d682637da7fbe2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chatgpt_cli_tool-1.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20ea52b74e4d35bd8c0322440c470e3ff0a7ba13b61a16bc414890d13ad02b18
MD5 02c4f744544476bdde8443341244dc33
BLAKE2b-256 81e27cb3a3e4df190c33c4553da4d617bda69b5c1d13695dc6106c5af08e716d

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