heygpt

A simple common-line interface for ChatGPT API.

Screen Shot 2023-03-07 at 09 30 53

Demo (YouTube)

Quickstart

Install to $HOME/.cargo/bin/ via cargo:

bash cargo install --path .

You'll need a OpenAI API key (you can get one here), and you'll need to export your API Key as an environment variable:

You can also set a OpenAI API base environment variable, just like openai-python

```bash export OPENAIAPIKEY=

export OPENAIAPIBASE="https://api.openai.com/v1"

```

Then you can start an interactive conversation with ChatGPT:

bash heygpt

OR use the one-shot mode by providing a prompt:

bash heygpt how to record screen on mac

You can also compose prompt with bash tricks like

bash heygpt read the code and tell me what it is doing: $(cat src/main.rs)

bash heygpt read the code diff and write a commit message: $(git diff)

You may need write prompt in multiple lines:

```bash heygpt "please translate this poem to English:

εΊŠε‰ζ˜Žζœˆε…‰οΌŒ η–‘ζ˜―εœ°δΈŠιœœγ€‚ δΈΎε€΄ζœ›ζ˜ŽζœˆοΌŒ δ½Žε€΄ζ€ζ•…δΉ‘γ€‚" ```