GPT CLI is a versatile command-line tool that enables ChatGPT integration into CLI and Vim environments. It facilitates executing ChatGPT queries from anywhere cli programs can be run, making it easier to analyze or modify code, generate documentation, and more.
- Environment Variables: Leverages
OPENAI_API_KEY
for secure API configuration and allows settingOPENAI_DEFAULT_MODEL
to choose the desired language model. - CLI and Vim Integration: Enhances command-line workflows and Vim editing with direct ChatGPT integration for insights and content generation.
Set the OPENAI_API_KEY
environment variable to authenticate API requests. Optionally, set OPENAI_DEFAULT_MODEL
to specify the default language model.
For Unix-like environments, you can use the install.sh
script located in the root of this project:
./install.sh
Direct CLI usage:
chat [prompt]
Piping command output to ChatGPT:
ls | chat explain the following files
In Visual Mode, you can:
Replace selected text with ChatGPT suggestions:
:'<,'>!chat improve this rust function
Query ChatGPT about selected text without replacement:
:'<,'>w !chat what does this function do
For the latest build information, see the GitHub Actions build status:
Leverage GPT CLI to streamline your CLI and Vim interactions through ChatGPT's capabilities.