app ask-gpt

CLI tool for interacting with OpenAI's API including ChatGPT + GPT-4

1 unstable release

0.1.0 Mar 19, 2023

#710 in Cargo plugins

MIT/Apache

11KB
69 lines

Ask GPT

This project is a simple command-line interface (CLI) tool for interacting with OpenAI's API including (ChatGPT, GPT-4). The tool allows users to send text to a GPT model and receive generated responses.

Prerequisites

Rust programming language installed (>= 1.68.0) An OpenAI API key (you can obtain one by signing up at https://openai.com)

Setup

  1. Download the binary from the crates.io repository
cargo install ask-gpt
  1. Then, you'll need to make sure your cargo bin directory is in your path. You can do this by adding the following to your ~/.bashrc or ~/.zshrc:
export PATH="$PATH:$HOME/.cargo/bin"
  1. Create a .env file in the project directory and add your OpenAI API key:

Replace your_openai_api_key with your actual OpenAI API key.

touch .env
echo "OPENAI_KEY=your_openai_api_key" > .env

Usage

  1. Enter your input text, finishing with an empty line:
Enter the content (finish input with an empty line):
Hello, how are you?
  1. The tool will send the input to the GPT-3.5 Turbo model and print the generated response:
ChatGpt: Hello! I'm doing well, thank you. How can I help you today?

To exit the program, press Ctrl+C.

Contribute

  1. Clone the repository:
git clone https://github.com/dave-hay/ask-gpt.git
cd ask-gpt
  1. Create a .env file in the project directory and add your OpenAI API key:

Replace your_openai_api_key with your actual OpenAI API key.

touch .env
echo "OPENAI_KEY=your_openai_api_key" > .env
  1. Build the project:
cargo build --release
  1. Run the executable:
./target/release/ask-gpt

License

This project is licensed under the MIT License. See the LICENSE file for details.

Dependencies

~7–19MB
~258K SLoC