Oh My GPT is a Zsh plugin that provides an easy-to-use interface for interacting with OpenAI's GPT models directly from your terminal. It allows you to send queries, analyze files, and get AI-powered assistance for various tasks.
- Interact with GPT-3.5 and GPT-4 models
- Send custom queries or file contents for analysis
- Save responses to output files
- Built-in error handling and dependency checks
Ensure you have the following installed:
- zsh
- curl
- jq
-
If you haven't already, install Antigen.
-
Add the following line to your
.zshrc
file:antigen bundle vicotrbb/oh-my-gpt
-
Reload your
.zshrc
or restart your terminal:source ~/.zshrc
-
Clone this repository:
git clone https://github.com/vicotrbb/oh-my-gpt.git ~/.oh-my-zsh/custom/plugins/oh-my-gpt
-
Add the plugin to your
.zshrc
file:plugins=(... oh-my-gpt)
-
Reload your
.zshrc
or restart your terminal:source ~/.zshrc
-
Set your OpenAI API key in your
.zshrc
file:export OPENAI_API_KEY="your-api-key-here"
To send a basic query to the GPT model, use the following command:
gpt "Your question or prompt here"
For example:
gpt "What is the capital of France?"
You can specify which model to use with the --model
flag:
gpt --model gpt-3.5-turbo "Explain quantum computing in simple terms"
To analyze the contents of a file, use the --file
flag:
gpt --file path/to/your/file.txt "Summarize this file"
To save the response to a file, use the --output
flag:
gpt "Write a short story about AI" --output story.txt
You can combine various options:
gpt --model gpt-4 --file code.py "Explain this code" --output explanation.md