gpterm is a terminal-based integration with the OpenAI chat API.
image-2023-04-09-t9i9MeKD.mp4
gpterm also renders Markdown and syntax-aware code blocks:
![image-2023-05-24-T5sJJ5vm@2x](https://private-user-images.githubusercontent.com/596076/240636939-a33c4470-0275-4927-b346-00a68bdcc4e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEyMTIyNDksIm5iZiI6MTcyMTIxMTk0OSwicGF0aCI6Ii81OTYwNzYvMjQwNjM2OTM5LWEzM2M0NDcwLTAyNzUtNDkyNy1iMzQ2LTAwYTY4YmRjYzRlOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxN1QxMDI1NDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMWNjNGE2NWU1ZGQyMjhkZWM4MjI3OGY5ZWIyNjIzOTM4YmQyZjBmZWFiOWE3NTAyMDUzMDcwNWQ4ZDM4OGYzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.DNDt7AjRYo0WdFfezCQaihOR4VUCz7iNbozc5hZMWKM)
Requirements:
- Go 1.18 or higher
- GOPATH env variable set (install will write to
$GOPATH/bin
) - OpenAI API Key
To install from source:
git clone https://github.com/collinvandyck/gpterm.git
cd gpterm
make install
Because it uses the OpenAI API, an API key is required before you can start:
# set api key
gpterm auth
Once the API key has been set, have fun!
# enter an interactive session
gpterm
Once you're in gpterm, there are a handful of controls you can use to tailor your experience.
Ctrl-y
spawn an editor to craft your message instead of using the text widget.Ctrl-p/Ctrl-n
switch between previous and next conversations.Ctrl-x
drops the current conversation.Ctrl-x
again to confirm.F1/F2
change the amount of conversation context sent to OpenAI on each request. Higher values will result in more coherence but at a greater API cost.F3
change the GPT model. Currently supportsgpt-3.5-turbo
andgpt-4
. You must havegpt-4
access for that mode to work. Because costs between the models are quite different, gpterm remembers the amount of conversation context to send per-model.
Chat history and your API key are stored in a sqlite database in:
~/.config/gpterm
Users will be able to instruct OpenAI how to act. Currently it's hardcoded to You are a helpful assistant.
Additionally, users should be able to change the name of the assistant as rendered in the chatlog. Current it is ChatGPT
.
Conversations should be able to be uploaded to a gist.
Actions should be able to be found to user-configured keys.