Awesome
Oh My GPT Zsh Plugin
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.
Features
- 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
Installation
Prerequisites
Ensure you have the following installed:
- zsh
- curl
- jq
Using Antigen
-
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
Manual Installation
-
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
Configuration
-
Set your OpenAI API key in your
.zshrc
file:export OPENAI_API_KEY="your-api-key-here"
Usage
Basic Query
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?"
Using Different Models
You can specify which model to use with the --model
flag:
gpt --model gpt-3.5-turbo "Explain quantum computing in simple terms"
Analyzing Files
To analyze the contents of a file, use the --file
flag:
gpt --file path/to/your/file.txt "Summarize this file"
Saving Output
To save the response to a file, use the --output
flag:
gpt "Write a short story about AI" --output story.txt
Combining Options
You can combine various options:
gpt --model gpt-4 --file code.py "Explain this code" --output explanation.md