Note
Early version; examples and options subject to change.
Versatile OpenAI API client in Bash. Append text queries, files, images, screenshots and stdin as separate message modules to the payload, with minimal limitation. Dry run to inspect payload.
Dependencies:
jq
grim
andslurp
for screenshot functionality (Linux Wayland only atm.)- An OpenAI API key
git clone [email protected]:fredfoss/gpt-bash.git
cd gpt-bash
make install
gpt
will be copied to ~/.local/bin/
. Remember to add directory to path. Example, in ~/.bashrc
:
export PATH=$HOME/.local/bin:$PATH
Then, set the OPENAI_API_KEY environment variable with your API key. Example, in ~/.bashrc
:
export OPENAI_API_KEY=sk-proj....HB7WOAPmt
If you don't want to make it an environment variable, you could instead store the key in pass. Add the key to pass, then in ~/.bashrc
something like:
alias gpt='OPENAI_API_KEY=$(pass openai.com/api-key) gpt'
usage:
gpt [options] [query]
options:
-q <query> add additional query to payload
-f <file> add file as additional query
-i <image> add PNG image file to payload
-p add screenshot to payload
-d dry-run mode, don't call API
-h print help
gpt what is the zig language?
gpt -p what is the object in this screenshot
gpt compare provided images -i path/to/img1.png -i path/to/img2.png
gpt -f file/with/userinput.c explain this code
gpt -q first query -q "then the second" and finally the third
OPENAI_API_KEY
OPENAI_API_MODEL
OPENAI_API_TEMP
OPENAI_API_MAX_TOKENS
- Support article urls?
- Support youtube urls?
- Support other image formats beside png?
- Remember conversation?
- System prompt option: gpt -s new system prompt
- Check if API key is set
- Temperature option: gpt -t 0.5
- Finish Makefile
- MacOS patch
- Linux X11 patch