# 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 ```shell cargo install ask-gpt ``` 2. 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: ```shell export PATH="$PATH:$HOME/.cargo/bin" ``` 3. 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. ```shell touch .env echo "OPENAI_KEY=your_openai_api_key" > .env ``` ## Usage 1. Enter your input text, finishing with an empty line: ```shell Enter the content (finish input with an empty line): Hello, how are you? ``` 2. The tool will send the input to the GPT-3.5 Turbo model and print the generated response: ```shell 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: ```shell git clone https://github.com/dave-hay/ask-gpt.git cd ask-gpt ``` 2. 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. ```shell touch .env echo "OPENAI_KEY=your_openai_api_key" > .env ``` 3. Build the project: ```shell cargo build --release ``` 4. Run the executable: ```shell ./target/release/ask-gpt ``` ## License This project is licensed under the MIT License. See the LICENSE file for details.