zsh functions that integrate OpenAI LLMs into your command line.
Works on OSX and linux environments that use gnome.
| Command | Description |
|---|---|
ai | General Purpose AI CLI tool. You can ask it to create a shell command, and it'll put it directly into the command buffer. You can ask it for information or to analyze piped in content, and it'll echo it to the terminal. You can ask it to generate images, and it'll generate one and give you a url. You can ask it to say something, and it'll do text to speech on it. You can ask it to crawl the web for information. |
ai-vision | Screen grab, add text, ask vision model. Uses OS builtins for screen grab and text input/output popups. Designed to be mapped to an OS keyboard shortcut and used outside a terminal. |
ai-openai-models | Enumerate what models your OPENAI_API_KEY has access to. It just lists out all the openai models you currently have access to, easy peazy. |
OPENAI_API_KEYenvironment variable set. As it stands, you'll also need access to thegpt-4based models, which you can get by prepaying for the openai API at https://platform.openai.com/account/billing/overview.
In your ~/.zshrc, where path/to/ai-functions/ is this project's root,
# aaronik/ai-functions https://github.com/Aaronik/ai-functions export PATH=path/to/ai-functions/bin:$PATH # Get ai-openai-models and ai-vision source /path/to/ai-functions/ai.zsh # Source as zsh function so `print -z` worksai list all open portsai show me the weather in my local regionai watch star wars in the terminalai monitor CPU and memory usage and alert if too highai convert all jpg images in a folder to pngai create a new user with sudo privilegesai set up a cron job to run a script every day at midnightlsusb | ai disconnect from all bluetooth devicesifconfig | ai port knock my local machinetail -20 /var/log/syslog | ai is there any unusual activity in this log?cat /var/log/auth.log | ai are there any suspicious login attempts here?ai generate a medium size image of a dog meditating on saturnai generate a high quality image, in a realistic style, of a computer coming to lifeai say hello there, human, in a warm, female voicesummarize the headlines from today
ai-visionai-openai-models
You can set OPENAI_API_MODEL to specify what model you want, ex OPENAI_API_MODEL=gpt-4-preview-1106 ai list all open ports
You can see an old video demo of the ai() function here: https://youtu.be/a_5-7qCuzpw