Home

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

Installation

Prerequisites

Ensure you have the following installed:

Using Antigen

  1. If you haven't already, install Antigen.

  2. Add the following line to your .zshrc file:

    antigen bundle vicotrbb/oh-my-gpt
    
  3. Reload your .zshrc or restart your terminal:

    source ~/.zshrc
    

Manual Installation

  1. Clone this repository:

    git clone https://github.com/vicotrbb/oh-my-gpt.git ~/.oh-my-zsh/custom/plugins/oh-my-gpt
    
  2. Add the plugin to your .zshrc file:

    plugins=(... oh-my-gpt)
    
  3. Reload your .zshrc or restart your terminal:

    source ~/.zshrc
    

Configuration

  1. 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