OpenAI CLI is a command-line interface (CLI) written in Golang that allows users to interact with the OpenAI API using the chat option. Users can pass prompts using the --prompt
flag or through STDIN, allowing for a flexible and convenient way to interact with the OpenAI API.
To use the OpenAI CLI, you don't need to have Golang installed. You can download the pre-built binaries for your operating system from the Releases page.
- Go to the Releases page of the GitHub repository.
- Download the appropriate binary for your operating system (e.g.,
openai_cli-windows-amd64.exe
for Windows,openai_cli-darwin-amd64
for macOS, oropenai_cli-linux-amd64
for Linux). - Place the downloaded binary in a directory that's included in your system's
PATH
environment variable.
To use the OpenAI CLI, you'll need an API key from OpenAI. If you don't have one yet, you can sign up for an account and obtain an API key from the OpenAI website.
You can use the chat
command along with the --prompt
flag to interact with the OpenAI API. Here's an example of how to use it:
$ OPENAI_API_KEY=your_token_here openai_cli chat --prompt='Something interesting'
Replace your_token_here with your actual OpenAI API key.
Alternatively, you can pass the prompt through STDIN. Create a file (e.g., prompt_file.txt) containing your prompt text, and then use the following command:
$ cat prompt_file.txt | openai_cli
This will read the contents of prompt_file.txt and use it as the prompt for interacting with the OpenAI API.
Contributions to the OpenAI CLI are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository and clone it to your local machine.
- Create a new branch for your feature or bug fix.
- Make your changes and test thoroughly.
- Commit your changes with clear commit messages.
- Push your branch to your forked repository.
- Create a pull request to the main repository.
- Before submitting a pull request, please ensure that your code adheres to the project's coding standards and practices.
This project is licensed under the MIT License.
❗️This README was generated with the assistance of an AI language model 😄